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 will contain NULLs for columns from the left table.
Click to reveal answer
beginner
In a RIGHT JOIN, what happens when a row in the right table has no matching row in the left table?
The row from the right table still appears in the result, but columns from the left table will have NULL values.
Click to reveal answer
intermediate
How is a RIGHT JOIN different from a LEFT JOIN?
A RIGHT JOIN returns all rows from the right table and matching rows from the left, while a LEFT JOIN returns all rows from the left table and matching rows from the right.
Click to reveal answer
intermediate
Consider these tables:<br>Table A: ids 1, 2<br>Table B: ids 2, 3<br>What rows will a RIGHT JOIN on id return?
It will return rows with ids 2 and 3. For id 2, matching data from both tables appears. For id 3, data from Table A will be NULL because there is no match.
Click to reveal answer
intermediate
Why might you use a RIGHT JOIN instead of a LEFT JOIN?
You use a RIGHT JOIN when you want to keep all rows from the right table regardless of matches in the left table. It depends on which table's data you want to preserve fully.
Click to reveal answer
What does a RIGHT JOIN return?
✗ Incorrect
A RIGHT JOIN returns all rows from the right table and matching rows from the left table, filling with NULLs when no match exists.
If a row in the right table has no match in the left table, what will the LEFT table columns show?
✗ Incorrect
When there is no match, columns from the left table will show NULL values in the result.
Which SQL join is the opposite of RIGHT JOIN?
✗ Incorrect
LEFT JOIN is the opposite of RIGHT JOIN because it returns all rows from the left table and matching rows from the right.
In a RIGHT JOIN, which table's rows are always fully included?
✗ Incorrect
RIGHT JOIN always includes all rows from the right table.
What will be the result of RIGHT JOIN if both tables have no matching rows?
✗ Incorrect
RIGHT JOIN returns all rows from the right table, with NULLs for left table columns if no match exists.
Explain how a RIGHT JOIN works and when you would use it.
Think about which table's rows you want to keep completely.
You got /4 concepts.
Describe the difference between LEFT JOIN and RIGHT JOIN with an example.
Consider two tables with overlapping and unique ids.
You got /4 concepts.