Search⌘ K
AI Features

Discover the Data Model

Explore the Million Song Dataset by learning to query and understand its data model using PostgreSQL. Discover how artists, tags, and track information relate, and practice writing SQL queries to extract insights about popular artists and their favorite songs.

We'll cover the following...

Time to discover the data model and the data itself with the first batch of interactive queries, with the sole aim of fulfilling our curiosity:

PostgreSQL
select artist, count(*)
from lastfm.track
group by artist
order by count desc
limit 10;

We can see that one of the most popular artists in the dataset is Aerosmith:

           artist            │ count 
═════════════════════════════╪═══════
 Mario Rosenstock            │    13
 Aerosmith                   │    12
 Snow Patrol                 │    12
 Phil Collins                │    12
 Sugar Minott                │    11
 Bill & Gloria Gaither       │    11
 Line Renaud                 │    11
 Shakira                     │    11
 Radiohead                   │    11
 Nick Cave and the Bad Seeds │    11
(10 rows)

Now, let’s have a look at the kind of tags this artist would ...