These are exercises querying the Chinook Database utilizing SQLite and DB Browser. The Chinook Dataset mimics a music service account database, so there are tables for Artists, Albums, Tracks, Playlists, Customers, Employees, and Invoices as outlined in the Entity Relationship Diagram (ERD) below.
Check Out the Chinook Database on Codeplex
Look in the sql
directory for all the SQL files and queries. Each file contains a specific data extraction objective.
- Provide a query that shows the top 3 best selling artists.
SELECT a.Name 'Artist', sum(li.UnitPrice) 'Total Sold'
FROM InvoiceLine li, Track t, Album al, Artist a
WHERE li.TrackId = t.Trackid
and al.AlbumId = t.AlbumId
and a.ArtistId = al.ArtistId
GROUP BY a.Name
ORDER BY COUNT(a.ArtistId) DESC
limit 3;