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

Revision as of 04:31, 3 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 comp...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
 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
10SELECT W1.employeename 
11FROM Works W1
12WHERE salary > (SELECT AVG(W2.salary) 
13                FROM Works W2 
14                WHERE W1.companyname = W2.companyname);