0
0
MySQLquery~5 mins

RIGHT JOIN in MySQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
AAll rows from the left table and matching rows from the right table
BAll rows from both tables
COnly matching rows from both tables
DAll rows from the right table and matching rows from the left table
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?
ANULL values
BEmpty strings
CThe matching values
DZeroes
Which SQL keyword is used to combine rows from two tables based on a related column?
AWHERE
BSELECT
CJOIN
DGROUP BY
How can you get the same result as a RIGHT JOIN using a LEFT JOIN?
AYou cannot get the same result
BSwitch the order of the tables and use LEFT JOIN
CUse FULL JOIN
DUse INNER JOIN instead
Which of these is true about RIGHT JOIN?
AIt returns all rows from the right table
BIt returns all rows from the left table
CIt returns only rows with matches in both tables
DIt excludes rows with NULL values
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.