SQL RIGHT & FULL JOIN

All rows from the right, or from both tables.

✍️ 3 exercises + code challenge in this lesson

RIGHT JOIN is the mirror of LEFT JOIN: every row from the right table is kept.

FULL OUTER JOIN keeps every row from both tables, with NULLs where there is no match.

In the example, order 1012 (customer 99 does not exist) and customers without orders both appear.

MySQL does not support FULL JOIN; combine a LEFT JOIN and a RIGHT JOIN with UNION instead.

Key Takeaways: SQL RIGHT & FULL JOIN

Mastering SQL RIGHT & FULL JOIN helps you write clean and reliable SQL code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.

SQL RIGHT & FULL JOIN Code Example

SQL
SELECT c.CustomerName, o.OrderID
FROM Customers c
RIGHT JOIN Orders o ON o.CustomerID = c.CustomerID;

SELECT c.CustomerName, o.OrderID, o.Status
FROM Customers c
FULL OUTER JOIN Orders o ON o.CustomerID = c.CustomerID
WHERE c.CustomerID IS NULL OR o.OrderID IS NULL;
Free sign-in required · Google login available

SQL RIGHT & FULL JOIN Practice Exercises

Check what you learned in “SQL RIGHT & FULL JOIN”.

/ 3 solved
Fill in the blank

Keep every row from both tables.

SELECT * FROM Customers c  Orders o ON o.CustomerID = c.CustomerID;
✓ Correct! Not quite. Try again.
Multiple choice

Which database does NOT support FULL JOIN?

✓ Correct! Not quite. Try again.
Code challenge

Using a RIGHT JOIN from Customers to Orders, select the OrderID of orders that have no matching customer.

Write the code in the live editor. Your answer is checked automatically.

Free sign-in required · Google login available

to save your exercise progress.
Finished this lesson?
Mark it complete to track your progress.

Stuck on something?

Ask the community in the CodesInTech forum.

Need a developer?

Learning on your own is great — and when you need professional help, our team builds custom software, websites and mobile apps for clients worldwide.

Explore Our Services