SQL LEARNING PLATFORM
Keeping all right table rows — even when there is no match.
Learning Blocks
Interactive Queries
Concepts you'll master
RIGHT JOIN returns ALL rows from the right table
Matching rows from the left table are included
If no match is found, NULL values are returned
In SQLite, RIGHT JOIN is not supported directly
We simulate RIGHT JOIN using LEFT JOIN by reversing table order
🌟 Think of it this way: You want all orders, even if some customers are missing. RIGHT JOIN keeps all rows from the right table (orders). In SQLite, we achieve this by reversing the tables and using LEFT JOIN.
Returns all orders, including those that may not have matching customers (simulated using LEFT JOIN).
SELECT o.order_id, c.name, o.total FROM orders o LEFT JOIN customers c ON c.customer_id = o.customer_id ORDER BY o.order_id;
Find orders that do NOT have matching customers using LEFT JOIN + IS NULL.
SELECT o.order_id FROM orders o LEFT JOIN customers c ON c.customer_id = o.customer_id WHERE c.customer_id IS NULL;
✅ Pro Tip: RIGHT JOIN is rarely used in practice. Most developers prefer LEFT JOIN because it is more readable and widely supported.
Practice your SQL skills