January 2018
Intermediate to advanced
446 pages
12h 57m
English
Find the 10 employees with the highest average salaries:
mysql> SELECT emp_no, AVG(salary) AS avg FROM salaries GROUP BY emp_no ORDER BY avg DESC LIMIT 10;+--------+-------------+| emp_no | avg |+--------+-------------+| 109334 | 141835.3333 || 205000 | 141064.6364 || 43624 | 138492.9444 || 493158 | 138312.8750 || 37558 | 138215.8571 || 276633 | 136711.7333 || 238117 | 136026.2000 || 46439 | 135747.7333 || 254466 | 135541.0625 || 253939 | 135042.2500 |+--------+-------------+10 rows in set (0.91 sec
Read now
Unlock full access