Billboard Top 100 Year End Table

Table: billboard_top_100_year_end

Schema:

year

int

year_rank

int

group_name

varchar

artist

varchar

song_name

varchar

id

int

Preview:

year
year_rank
group_name
artist
song_name
id

1956

1

Elvis Presley

Elvis Presley

Heartbreak Hotel

1

1956

2

Elvis Presley

Elvis Presley

Don't Be Cruel

2

1956

3

Nelson Riddle

Nelson Riddle

Lisbon Antigua

3

1956

4

Platters

Platters

My Prayer

4

1956

5

Gogi Grant

Gogi Grant

The Wayward Wind

5

MEDIUM

Find the top 10 ranked songs in 2010

What were the top 10 ranked songs in 2010? Output the rank, group name, and song name but do not show the same song twice. Sort the result based on the year_rank in ascending order.

SELECT DISTINCT year_rank, group_name, song_name
FROM billboard_top_100_year_end
WHERE year = 2010
ORDER BY year_rank
LIMIT 10;

Top 10 Songs

Find the number of songs of each artist which were ranked among the top 10 over the years. Order the result based on the number of top 10 ranked songs in descending order.

SELECT 
    artist, 
    COUNT(id) AS num_top10_songs
FROM billboard_top_100_year_end
WHERE year_rank <= 10
GROUP BY 1
ORDER BY COUNT(id) DESC;

The Best Artist

Find the number of times an artist has been on the billboard top 100 in the past 20 years. Output the result alongside the artist's name and order records based on the founded count in descending order.

SELECT 
    artist, 
    COUNT(id) AS num_top10_songs 
FROM billboard_top_100_year_end
WHERE year >= (SELECT MAX(year) - 20 
                FROM billboard_top_100_year_end) 
GROUP BY 1 
ORDER BY COUNT(id) DESC;

Find the top-ranked songs for the past 20 years.

Find all the songs that were top-ranked (at first position) at least once in the past 20 years

SELECT DISTINCT song_name
FROM billboard_top_100_year_end
WHERE year_rank = 1 
AND year >= (SELECT MAX(year) - 20 FROM billboard_top_100_year_end);

Last updated