Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

Employee salary aggregates

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

From employees, return a single row with: employee_count: COUNT(*) avg_salary: ROUND(AVG(salary), 2) min_salary: MIN(salary) max_salary: MAX(salary) AVG/MIN/MAX ignore NULL salaries.

Requirements

  • At least one non-null salary exists in the seed.

Constraints

  • Round the average to 2 decimal places.
  • Return exactly these columns: employee_count, avg_salary, min_salary, max_salary.

Examples

Input: employees name | salary Alice Chen | 120000 Bob Kumar | 95000 Dan Park | 110000 Eve Ng | 95000 Omar Ali | 105000 Max Reed | NULL Output: employee_count | avg_salary | min_salary | max_salary 6 | 105000.0 | 95000 | 120000 Why this passes: COUNT(*) includes the NULL-salary row. AVG/MIN/MAX skip NULL over the five paid salaries.

Topics: lakebench, sql, agg, avg.

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

beginner

Employee salary aggregates

Interview-style drill: Return count, average, min, and max salary across all employees.

From `employees`, return a single row with: - `employee_count`: COUNT(*) - `avg_salary`: ROUND(AVG(salary), 2) - `min_salary`: MIN(salary) - `max_salary`: MAX(salary) AVG/MIN/MAX ignore NULL salaries.