<code>RIGHT JOIN</code> is similar to <code>LEFT JOIN</code>, but reversed. All rows from the second (<b>right</b> of <code>JOIN</code>) table appear in the results, and only rows from the first ("left") table with matches to the second table appear. The non-matching rows will show null. Try:<br><br>
Table companies
| company_id | company_name | headquarters |
|---|---|---|
| 1 | Apple | Cupertino |
| 2 | Microsoft | Redmond |
| 3 | Mountain View | |
| 4 | Amazon | Seattle |
| 5 | Meta | Menlo Park |
| 6 | Netflix | Los Gatos |
Table employees
| employee_id | employee_name | company_id |
|---|---|---|
| 1 | Alice Chen | 1 |
| 2 | Brian Lee | 3 |
| 3 | Carla Gomez | 2 |
| 4 | David Kim | 7 |
| 5 | Elena Rossi | 4 |
| 6 | Frank Moore | null |
| 7 | Grace Patel | 5 |
RIGHT JOIN - SQL Practice Online
Practise RIGHT JOIN with 10 interactive SQL exercises. You type real queries into your browser and get instant feedback on every answer - no database setup and no install. It is a fast, hands-on way to learn SQL online and build query skills you can use at work.