RIGHT JOIN1 / 10
RIGHT JOIN is similar to LEFT JOIN, but reversed. All rows from the second (right of JOIN) 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:SELECT e.employee_name, c.company_name FROM companies AS c RIGHT JOIN employees AS e ON c.company_id = e.company_id;
Note which employees in the second table don't have a company_id with a match in the first table.
Also note that we are shortening the query by using table aliases to rename the tables "c" and "e."
Ctrl+Enter to submit
RIGHT JOIN - Free SQL Practice Online
Practise RIGHT JOIN with 10 free, interactive SQL exercises. You type real queries into your browser and get instant feedback on every answer - no database setup, no install, and no signup. It is a fast, hands-on way to learn SQL online and build query skills you can use at work.