Databases · Junior · Question 22 of 75

What does a LEFT JOIN return?

SELECT u.name, o.id
FROM users u
LEFT JOIN orders o ON o.user_id = u.id;

Explanation

A LEFT JOIN keeps all rows from the left table. RIGHT JOIN does the same for the right table, and FULL JOIN keeps unmatched rows from both.

Further reading

Problem with a question

Databases · Junior · question 22

Test yourself

Take the Databases · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz