Changes between Initial Version and Version 1 of TopPerformingComponents


Ignore:
Timestamp:
01/27/26 23:46:27 (12 days ago)
Author:
233051
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TopPerformingComponents

    v1 v1  
     1= Complex DB Reports (SQL, Stored Procedures, Relational Algebra) =
     2
     3===  Top Performing Components in Highly-Rated Builds ===
     4
     5Report on which specific components appear most frequently in builds that have received a high average user rating (4.5 stars or higher) within the last year.
     6
     7SQL:
     8
     9{{{
     10SELECT
     11    c.type,
     12    c.brand,
     13    c.name,
     14    COUNT(bc.component_id) AS usage_count,
     15    AVG(rb.value) AS avg_build_rating
     16FROM components c
     17JOIN build_component bc ON c.id = bc.component_id
     18JOIN build b ON bc.build_id = b.id
     19JOIN rating_build rb ON b.id = rb.build_id
     20WHERE b.created_at >= CURRENT_DATE - INTERVAL '1 year'
     21GROUP BY c.type, c.brand, c.name
     22HAVING avg_build_rating >= 4.5
     23ORDER BY usage_count DESC, avg_build_rating DESC
     24LIMIT 20;
     25}}}
     26
     27Relational algebra:
     28
     29{{{
     30λ_20(
     31 τ_{usage_count DESC, avg_build_rating DESC}(
     32  σ_{avg_build_rating ≥ 4.5}(
     33   γ_{c.type, c.brand, c.name;
     34     COUNT(bc.component_id)→usage_count,
     35     AVG(rb.value)→avg_build_rating
     36   }(
     37    σ_{b.created_at ≥ CURRENT_DATE - 1 year}(
     38     (((components c ⋈_{c.id=bc.component_id} build_component bc)
     39       ⋈_{bc.build_id=b.id} build b)
     40       ⋈_{b.id=rb.build_id} rating_build rb)
     41    )
     42   )
     43  )
     44 )
     45)
     46}}}