w3resource
SQLite exercises

SQLite Exercise: Find the manager ID and the salary of the lowest-paid employee for that manager

Write a query to find the manager ID and the salary of the lowest-paid employee for that manager.

Sample table : employees


SQLite Code:

SELECT manager_id, MIN(salary)
FROM employees
WHERE manager_id IS NOT NULL
GROUP BY manager_id
ORDER BY MIN(salary) DESC;

Output:

manager_id  MIN(salary)
----------  -----------
            24000
102         9000
205         8300
145         7000
146         7000
108         6900
147         6200
149         6200
148         6100
201         6000
100         5800
101         4400
103         4200
114         2500
123         2500
124         2500
120         2200
122         2200
121         2100

Sqlite Online Editor


Structure of 'hr' database :

hr database

Improve this sample solution and post your code through Disqus.

Previous: Write a query to get the difference between the highest and lowest salaries.
Next: Write a query to get the department ID and the total salary payable in each department.

What is the difficulty level of this exercise?