Yurttas/PL/DBL/mysql-f-2010/01/Company-B/q09.sql
Jump to navigation
Jump to search
1/*
2REM
3REM q09.sql
4REM
5REM Find all employees who earn more than the
6REM average salary of all employees of their company.
7REM
8*/
9
10\. set-db.sql
11
12SELECT W1.employeename
13FROM Works W1
14WHERE salary > (SELECT AVG(W2.salary)
15 FROM Works W2
16 WHERE W1.companyname = W2.companyname);