Simulate RIGHT JOIN: All Departments With Their Employees

Easy
joins Meta Amazon Netflix

Note: SQLite does not support RIGHT JOIN. Simulate it by swapping the table order and using a LEFT JOIN instead.

Return all departments (even those with no employees) alongside any employee names. Departments without employees should show NULL for emp_name.

Equivalent to: employees RIGHT JOIN departments

Simulate as: departments LEFT JOIN employees

Expected Output

dept_name emp_name
Engineering Alice
Engineering Bob
Marketing Carol
Legal NULL

Tables

Hints (2 available)

SQL Editor

Output

Click "Run" to see results...