Try a query

Sample queries

Start with a question about the data, then adapt the SQL for your own database engine.

Chinook

Artists by track count

Count tracks by artist.

SELECT Artist.Name, COUNT(Track.TrackId) AS Tracks FROM Artist JOIN Album USING (ArtistId) JOIN Track USING (AlbumId) GROUP BY Artist.ArtistId ORDER BY Tracks DESC LIMIT 10;
Get the database →

Chinook

Sales by billing country

Compare invoice totals across countries.

SELECT BillingCountry, ROUND(SUM(Total), 2) AS Sales FROM Invoice GROUP BY BillingCountry ORDER BY Sales DESC LIMIT 10;
Get the database →