Fairly new to SQL and I'm writing a practice query for a music database where I need to pull the top 10 songs by playing hours in January 2009. Here's the schema:
Here's my statement so far. I just wanted to know if I were going in the right direction because I know in order to create the query I need to sum the playing hours of each song and I included that within the ORDER BY clause:
SELECT song_name
FROM music LEFT JOIN client
ON music.id = client.music_id
WHERE client.date BETWEEN '2009-01-01' AND '2009-01-31'
ORDER BY SUM(client.playing_hrs) DESC;
