Yurttas/PL/DBL/oracle/F/01/Company-B/q09.sql

From ZCubes Wiki
Revision as of 22:56, 4 November 2013 by MassBot1 (talk | contribs) (Created page with "<syntaxhighlight lang="sql" line start="1" enclose="div"> REM REM q09.sql REM REM Find all employees who earn more than the REM average salary of all employees of their compan...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
 1REM
 2REM q09.sql
 3REM
 4REM Find all employees who earn more than the
 5REM average salary of all employees of their company.
 6REM
 7
 8SELECT W1.employeename 
 9FROM Works W1
10WHERE salary > (SELECT AVG(W2.salary) 
11                FROM Works W2 
12                WHERE W1.companyname = W2.companyname);