Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

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.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.