Last answered:

23 Feb 2024

Posted on:

21 Jul 2023

0

PLEASE HELP ME WITH IT

CAN SOMEONE PLEASE WRITE THE CODE I COULDN`T WRITE IT

5 answers ( 0 marked as helpful)
Instructor
Posted on:

21 Jul 2023

0

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

Posted on:

22 Jul 2023

0

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.

Posted on:

29 Jul 2023

0

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


Instructor
Posted on:

23 Aug 2023

2

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

Posted on:

23 Feb 2024

0

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

Submit an answer