Recall & Review
beginner
What does a RIGHT JOIN do in SQL?
A RIGHT JOIN returns all rows from the right table and the matching rows from the left table. If there is no match, the result is NULL on the left side.
Click to reveal answer
beginner
How is RIGHT JOIN different from LEFT JOIN?
RIGHT JOIN returns all rows from the right table, while LEFT JOIN returns all rows from the left table. Both include matching rows from the other table and NULLs where no match exists.
Click to reveal answer
beginner
Write a simple RIGHT JOIN query example.
SELECT * FROM employees RIGHT JOIN departments ON employees.department_id = departments.id; This returns all departments and their employees, including departments with no employees.
Click to reveal answer
beginner
What happens if there is no matching row in the left table for a RIGHT JOIN?
The columns from the left table will contain NULL values for those rows in the result.
Click to reveal answer
intermediate
Can RIGHT JOIN be replaced by LEFT JOIN?
Yes, by switching the order of the tables and using LEFT JOIN, you can get the same result as RIGHT JOIN.
Click to reveal answer
What does a RIGHT JOIN return?
✗ Incorrect
RIGHT JOIN returns all rows from the right table and matching rows from the left table, filling NULLs where no match exists.
If a row in the right table has no matching row in the left table, what will the LEFT table columns show in a RIGHT JOIN?
✗ Incorrect
When no match exists in the left table, the LEFT table columns show NULL in the result.
Which SQL keyword is used to combine rows from two tables based on a related column?
✗ Incorrect
JOIN is used to combine rows from two or more tables based on a related column.
How can you get the same result as a RIGHT JOIN using a LEFT JOIN?
✗ Incorrect
Switching the order of tables and using LEFT JOIN produces the same result as RIGHT JOIN.
Which of these is true about RIGHT JOIN?
✗ Incorrect
RIGHT JOIN returns all rows from the right table, regardless of matches.
Explain in your own words what a RIGHT JOIN does and give a simple example.
Think about which table's rows are always included.
You got /5 concepts.
How can you rewrite a RIGHT JOIN query using a LEFT JOIN? Describe the steps.
Consider swapping the tables in the FROM clause.
You got /4 concepts.