AlgoMaster Logo

Exercise: INNER JOIN

Last Updated: May 12, 2026

1 min read

For this exercise, we will work with below data:

SQL

Exercise 1

Easy

Show each artist's name and the title of their album using INNER JOIN between artists and albums. Order by artist name.

SQL

Expected Query

Expected Output

Exercise 2

Easy

Show each track's title and the name of its genre. Chain three tables (tracksalbumsgenres) with INNER JOIN. Order by track title.

SQL

Expected Query

Expected Output

Exercise 3

Medium

Show stream_idusername, and track title for every stream made by a user on the 'free' subscription tier. Use INNER JOIN across streamsusers, and tracks. Order by started_at.

SQL

Expected Query

Expected Output

Exercise 4

Medium

For each artist, show the name and the total number of streams across all their tracks. Chain four tables. Order by total_streams descending, then by artist name.

SQL

Expected Query

Expected Output

Exercise 5

Hard

For each user who has streamed something, count the number of distinct artists they have listened to. Use INNER JOIN across the full chain of tables. Show username and artists_listened. Order by artists_listened descending, then by username.

SQL

Expected Query

Expected Output