Brainlag
  1. SQL
  2. Core
15/39 lessons

Joining three tables or more

30 min6 exercisesPremium

Chain JOINs across a music streaming database to connect plays, songs, artists and listeners, and learn why joins multiply rows and how COUNT(DISTINCT) helps.

The skill
Follow ids across three or four tables and count without double counting.
You make
Play counts, listener counts and listening time for a music streaming service.

Premium lesson

£7.99 a month or £59 a year. Cancel any time.

Builds on 14 LEFT JOIN and the missing matches. Free to try: SQL Foundations and the playground.

Step 1 of 9
exercise_1.sql

You've reached the good stuff.

6 exercises in this lesson, checked as you type. Premium opens every lesson after Foundations, in all four courses.

SQLite