Simple JOINs recap
5. JOINs – recap
Various kinds of JOINs
Filtering with LEFT JOIN and RIGHT JOIN
Summary

## Instruction

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

SELECT
full_name,
name
FROM position
JOIN employee
ON position.id = 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

## Exercise

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!

Type:

SELECT
title,
name
FROM author
JOIN book
ON author.id = book.author_id


Code editor

TableConsole