SQL data engineering interview problem. Difficulty: advanced. Pattern: Aggregation. About 18 minutes. Part of the Pro drill bank.
Find the salary that appears most often among non-null employees.salary values. Return salary and freq. If there is a tie for most frequent, return all tied salaries. Order by salary.
Input: employees (salary freq) name | salary Bob Kumar | 95000 Eve Ng | 95000 Dan Park | 110000 Omar Ali | 105000 Output: salary | freq 95000 | 2 Why this passes: Mode is the salary with the highest frequency; 95000 appears twice.
Topics: lakebench, sql, mode, having.
More SQL interview questions · All interview problems · Learn data engineering
Interview-style drill: Most frequently occurring salary.
Find the salary that appears most often among non-null `employees.salary` values. Return `salary` and `freq`. If there is a tie for most frequent, return all tied salaries. Order by `salary`.