Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

Employees with optional department

SQL data engineering interview problem. Difficulty: beginner. Pattern: Joins. About 8 minutes. Free to practice.

Return every employee name and their department_name. Use a LEFT JOIN to departments. Employees without a matching department must still appear with NULL department_name. Order by name.

Constraints

  • Return exactly these columns: name, department_name.

Examples

Input: employees departments name | department_id department_id | department_name Alice Chen | 1 1 | Engineering Omar Ali | 2 2 | Sales Max Reed | 2 3 | Marketing Output: name | department_name Alice Chen | Engineering Max Reed | Sales Omar Ali | Sales Why this passes: LEFT JOIN keeps every employee. In this seed every row matches; unmatched employees would show NULL department_name.

Topics: lakebench, sql, left join.

More SQL interview questions · All interview problems · Learn data engineering

beginner

Employees with optional department

Interview-style drill: LEFT JOIN so employees without a department still appear.

Return every employee `name` and their `department_name`. Use a LEFT JOIN to `departments`. Employees without a matching department must still appear with NULL `department_name`. Order by `name`.