Show all employees even if department is missing (use LEFT JOIN).
Ready — edit the code above and click Run.
-- Sample schema
CREATE TABLE Employees (Id INT, Name TEXT, DeptId INT, Salary INT);
CREATE TABLE Departments (Id INT, Name TEXT);
INSERT INTO Employees VALUES (1,'Ali',1,90000),(2,'Sara',2,120000),(3,'Raj',1,75000);
INSERT INTO Departments VALUES (1,'Engineering'),(2,'Sales');
SELECT e.Name, d.Name AS Department
FROM Employees e
LEFT JOIN Departments d ON e.DeptId = d.Id;
Try solving on your own first, then reveal the official answer.
LEFT JOIN preserves left table rows; unmatched right side is NULL.