Help! This is the question I have to answer: Display the manager number and sala
ID: 3670695 • Letter: H
Question
Help! This is the question I have to answer:
Display the manager number and salary of the lowest paid employee for that manager. Exclude anyone whose manager is not known (NULL). Exclude any groups where the minimum salary is less than $1000. Sort the output in descending order of salary.
This is the code I wrote:
SELECT manager_id AS "Manager", MIN(salary) AS "Small Salary"
FROM employees
WHERE manager_id IS NOT NULL
GROUP BY manager_ID
HAVING MIN(salary) < 1000
ORDER BY "Small Salary" DESC;
It runs but it comes up with 0 records. What am I doing wrong?
Explanation / Answer
SELECT manager_id, MIN(salary)
FROM employees
WHERE manager_id IS NOT NULL
GROUP BY manager_id
HAVING MIN(salary) > 6000
ORDER BY MIN(salary) DESC;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.