Yurttas/PL/DBL/postgres/F/01/Company-B/q16.sql

Revision as of 00:44, 5 November 2013 by MassBot1 (talk | contribs) (Created page with "<syntaxhighlight lang="sql" line start="1" enclose="div">/* REM REM q16.sql REM REM Give all managers a 10 percent raise unless the REM salary becomes greater than $100,000. ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
 1/*
 2REM
 3REM q16.sql
 4REM
 5REM Give all managers a 10 percent raise unless the 
 6REM salary becomes greater than $100,000. In such cases,
 7REM give only a 3 percent raise.
 8REM
 9*/
10
11SELECT current_schema();
12SET search_path to "companyb";
13
14UPDATE Works
15SET salary = salary * 1.03
16WHERE employeename IN (SELECT managername
17                       FROM manages)
18  AND salary * 1.1 > 100000;
19
20UPDATE Works
21SET salary = salary * 1.1
22WHERE employeename IN (SELECT managername
23                       FROM manages)
24  AND salary * 1.1 <= 100000;