Save up to $499! Grab all Python courses for $49 or all online courses we’ve ever launched for only $169. Only Feb 11-16. Happy Valentine's!
Simple JOINs recap
5. JOINs – recap
Various kinds of JOINs
Filtering with LEFT JOIN and RIGHT JOIN


Alright! The easiest and most basic way to join two tables is to use the JOIN clause. Take a look:

FROM position
JOIN employee
ON = employee.position_id

As you can see, we simply list the name of the first table after the FROM clause as usual. Then, we put the keyword JOIN. And after that we specify the name of the second table.

The ON keyword allows us to specify the condition upon which we should join two tables. In our example, the database joins only those rows from both tables for which the value under the ID column of the table position is equal to the value under the position_id column of the employee table.

employee position
full_name position_id id name
Mark Zucchero 1 1 Java Developer
Sara Darling 2 2 Marketing Specialist
Joe Doe 3 3 Java Developer


Join the author table with the book table.

Select the title of each book and the name of its author.

Stuck? Here's a hint!


FROM author
JOIN book
  ON = book.author_id