Top Earners

Sort by

recency

|

3493 Discussions

|

  • + 0 comments

    After seeing answers from others I am shocked no one used CONCAT as in the expected output the expected results is not two columns but a single column containing two values with space. Here is my answer, Any query improvement is appreciated.

    and a count of the number of employees who have earned (which is ) as two space-separated values.

    SET NOCOUNT ON;
    
    SELECT CONCAT((salary*months)," ",count(salary*months)) FROM employee
    WHERE (salary*months) = (SELECT MAX(salary*months) FROM employee)
    GROUP BY (salary*months)
    
    go
    
  • + 0 comments

    SELECT salary * months as earnings, COUNT(employee_id) FROM Employee GROUP BY earnings ORDER BY earnings DESC LIMIT 1;

  • + 0 comments

    select months*salary, count(months*salary) from Employee group by months*salary order by months*salary desc limit 1;

  • + 0 comments

    SELECT MAX(salary * months) as earnings, COUNT(employee_id)
    FROM Employee WHERE salary * months = (SELECT MAX(salary * months) FROM Employee);

  • + 0 comments

    SELECT (salary * months) , COUNT(*)
    FROM Employee GROUP BY (salary * months) ORDER BY (salary * months) DESC limit 1