0

Chinook Database SQL Lite

I am trying to run a query from the well-known Chinook Database above that will give me the total price for each album. I have attempted to use the LEFT JOIN operator to retrieve data from the two tables that have the data I need to answer this question. The result I get is the sum of the unit prices but only the name of one album title. The goal is to get the title of EACH album and their total prices.

This is SQLite so the FULL Outer Join would not work in this case

Here is the code that I have so far:

SELECT (a.title), SUM(t.UnitPrice) AS TotalPrice
FROM albums a
LEFT JOIN tracks t
ON t.albumid = a.albumid
ORDER BY a.title;

Any response would be appreciated!

Sourav Dutta
  • 145
  • 8
je1227
  • 11
  • 3

0 Answers0