strawquery PT
All lessons

Lesson 17 of 30

Joining several tables

Today at the studio

The end credits need a list: who did what on which show. The answer sits in three tables, and Byte is certain it sits in none of them.

The idea

You can chain JOINs. Each one adds a table and says how it connects to the tables you already have.

Some tables exist only to connect others. credits links a show to a person with a task. Join it to both sides to read it: credits JOIN shows ... JOIN staff ....

Example

SELECT episodes.title, shows.genre, staff.name
FROM episodes
JOIN shows ON episodes.show_id = shows.id
JOIN staff ON shows.director_id = staff.id

Your turn

0 of 4 questions

Question 1 of 4

Who composed the music? For every credit with the task Music, show the show title, the person's name and the task.

Unofficial fan project. Titles belong to their creators and rights holders.