Pricing wants a per-genre breakdown of how many tracks are sold at the standard $0.99 rate versus the premium rate (UnitPrice above $0.99). For every genre, produce one row with a count for each price tier, using conditional aggregation.
Return GenreId, Name, StandardPriceCount (tracks priced at exactly $0.99), and PremiumPriceCount (tracks priced above $0.99), ordered by GenreId ascending.
Note: in this catalog, pricing splits cleanly by genre -- music genres are entirely standard-priced, while video/TV genres (Science Fiction, TV Shows, etc.) are entirely premium-priced. Seeing an all-zero column for a given genre is expected, not a bug.
| Column | Type |
|---|---|
| GenreId | INTEGER (Primary Key) |
| Name | TEXT |
| Column | Type |
|---|---|
| TrackId | INTEGER (Primary Key) |
| GenreId | INTEGER (Foreign Key -> Genre.GenreId) |
| UnitPrice | NUMERIC(10,2) |
Ready to take your skills to the next level? Enroll in our comprehensive Data Analyst Career Track to master SQL, Python, Excel, and Power BI.
Run your code to see the result here.