SQL data engineering interview problem. Difficulty: beginner. Pattern: Filtering. About 8 minutes. Part of the Pro drill bank.
Categorize each employee salary: 'Low' if salary < 50000 'Medium' if salary between 50000 and 100000 inclusive 'High' if salary > 100000 'Unknown' if salary IS NULL Return name, salary, salary_category. Order by name.
Input: employees name | salary Alice Chen | 120000 Bob Kumar | 95000 Max Reed | NULL Omar Ali | 105000 Output: name | salary | salary_category Alice Chen | 120000 | High Bob Kumar | 95000 | Medium Max Reed | NULL | Unknown Omar Ali | 105000 | High Why this passes: NULL must be handled explicitly or it falls through every comparison. No Low salaries exist in this seed.
Topics: lakebench, sql, case, case when.
More SQL interview questions · All interview problems · Learn data engineering
Interview-style drill: CASE WHEN to bucket salaries into Low, Medium, High, Unknown.
Categorize each employee salary: - 'Low' if salary < 50000 - 'Medium' if salary between 50000 and 100000 inclusive - 'High' if salary > 100000 - 'Unknown' if salary IS NULL Return `name`, `salary`, `salary_category`. Order by `name`.