Genre power ranking
Capstone. End-of-year presentation: rank the 8 genres by revenue. For each genre show name, track_count (tracks in the catalog), units (copies sold), revenue, a rank (ties share it — two genres are tied for 4th), and share — revenue as a percentage of the store total, rounded to 2 decimals. Three CTEs and a window RANK over the final result, ordered by rank.
Tables in this exercise
tracks
id title album_id genre_id duration_sec unit_price
genres
id name
invoice_lines
id invoice_id track_id quantity unit_price