SQL Reference

Quick Reference

The RIGHT JOIN keywords returns all rows from the right table, and the matching rows from the left table. The result is NULL from the left side if there is no match.

The following returns all employees and any orders they may have.

SELECT Orders.order_id, Employees.last_name, Employees.first_name
FROM Orders
RIGHT JOIN Employees ON Orders.employee_id = Employees.employee_id
ORDER BY Orders.order_id;

Note

The RIGHT JOIN keywords returns all records from the right table, even if there are no matches in the left table.


SQL Notes:

  • Any work being done to modify the structure of a database or delete tables or the the database itself should only be done after making a recent backup

We’d like to acknowledge that we learned a great deal of our coding from W3Schools and TutorialsPoint, borrowing heavily from their teaching process and excellent code examples. We highly recommend both sites to deepen your experience, and further your coding journey. We’re just hitting the basics here at 1SMARTchicken.