Total Sales by Genre (chinook database)

Medium
50.0% Acceptance

Your task is to calculate the total sales for each music genre in the Chinook database.

Tables Involved:

  • "InvoiceLine"
  • "Track"
  • "Genre"

SQL Elements to Use:

  • SUM()
  • JOIN
  • GROUP BY
  • ORDER BY

Ordering Criteria:
Sort the result by the "Name" column from the "Genre" table in ascending order.

Final Columns in Output:
Your output should contain two columns:

  • First column should be named genres.Name and contain the genre name.
  • Second column should be named TotalSales and represent the total sales for each genre.

Hints:

  • You will need to multiply the "UnitPrice" with "Quantity" in the "InvoiceLine" table to calculate the total sales per line item.