Employees With Department Names
Easy
Joins
List every employee's name with the name of their department. Employees without a department must still appear, showing 'Unassigned'. Order by employee id.
Table schema
Employees(id INT PRIMARY KEY, name VARCHAR(50), department_id INT NULL)
Departments(id INT PRIMARY KEY, name VARCHAR(50))Sample data
Employees:
id | name | department_id
1 | Alice | 1
2 | Bob | 2
3 | Carol | NULL
Departments:
id | name
1 | Engineering
2 | HR
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.