SQL - LEFT and RIGHT JOIN
Given tables
id | name | dept_id
1 | Alice | 10
2 | Bob | 20
3 | Carol | NULL
dept_id | dept_name
10 | Sales
20 | HR
30 | IT
What is the result of this query?
Employees and Departments with data:Employees:id | name | dept_id
1 | Alice | 10
2 | Bob | 20
3 | Carol | NULL
Departments:dept_id | dept_name
10 | Sales
20 | HR
30 | IT
What is the result of this query?
SELECT e.name, d.dept_name FROM Employees e LEFT JOIN Departments d ON e.dept_id = d.dept_id;
