PLEASE HELP ME WITH IT
CAN SOMEONE PLEASE WRITE THE CODE I COULDN`T WRITE IT
Hi Mustafa!
Thanks for reaching out.
Could you please explain which code are you referring to? This can help us assist you better. Thank you.
Hope this helps.
Best,
Tsvetelin
Write a query that obtains two columns. The first column must contain annual salaries higher than 80,000 dollars. The second column, renamed to "emps_with_same_salary", must show the number of employees contracted to that salary. Lastly, sort the output by the first column.
Hi Mustafa , best would be to utilise the previous assignment code and apply it to this exercise , giving you the code won't help you in the long run. Hope this helps
Hi Mustafa!
Thanks for reaching out.
Please, use the following code:
SELECT
salary, COUNT(emp_no) AS emps_with_same_salary
FROM
salaries
WHERE
salary > 80000
GROUP BY salary
ORDER BY salary;
Hope this helps.
Best,
Tsvetelin
Hi Mustafa,
what prof @Tsvetelin has shared is correct. i just wanted to make a small addition for curious minds
suppose tou wanted to order by the number of employees, maybe you wanted to see what majority of employees earn, you can modify it as:
SELECT
salary, count(emp_no) as emps_with_same_salary
FROM
salaries
WHERE
salary > 80000
group by salary
order by count(emp_no) desc; --this is the change i made