On January 28th at 9:00 UTC Academy will be unavailable for 10 minutes due to planned maintenance break.
Kickstart 2020 with new opportunities! - hours only!Up to 80% off on all courses and bundles.-Close
How to query more than one table
Creating JOINs
Referencing columns
Let's practice
13. Further practice


Excellent! We have one more exercise for you before the end of this part. You are going to write your longest SQL query yet, and you'll apply knowledge from both of the parts you've mastered so far. Are you ready?


Select the Id, Title, and ProductionYear columns from the Movie table and the Name and BirthYear columns from the Director table such that each movie is shown together with its director. Show the BirthYear column as BornIn and the ProductionYear column as ProducedIn. Select only those movies:

  • Whose title contains a letter 'a' and that was filmed after 2000.


  • Whose director was born between 1945 and 1995.

Stuck? Here's a hint!


  Movie.ProductionYear AS ProducedIn,
  Director.BirthYear AS BornIn
FROM Movie
JOIN Director
  ON Director.Id = DirectorId
    Movie.Title LIKE N'%a%'
    AND Movie.ProductionYear > 2000
  OR Director.BirthYear BETWEEN 1945 AND 1995;