How to query more than one table
Creating JOINs
Referencing columns
11. Filter the joined tables continued
Let's practice

Instruction

Excellent! Filtering the results is very important, so let's do another exercise on that. Do you still remember how text values work in SQL?

SELECT
  person.id, 
  car.model 
FROM person 
JOIN car 
 ON person.id = car.owner_id 
WHERE car.brand = 'Fiat';

In the above query, we only select cars branded 'Fiat'. Piece of cake, right? Let's practice.

Exercise

Select all columns from tables movie and director in such a way that a movie is shown together with its director. Select only those movies which were directed by Steven Spielberg.

Stuck? Here's a hint!

Type:

SELECT 
  * 
FROM movie 
JOIN director 
  ON director_id = director.id 
WHERE director.name = 'Steven Spielberg';