Which of the following relation updates all instructors with salary over $100,000 receive a 3 percent raise, whereas all others receive a 5 perc

Which of the following relation updates all instructors with salary over $100,000 receive a 3 percent raise, whereas all others receive a 5 percent raise.
A.
Code:
   Update instructor
   set salary = salary * 1.03
   where salary > 100000;
   update instructor
   set salary = salary * 1.05
   where salary <= 100000;
B.
Code:
   Update instructor
   set salary = salary * 1.05
   where salary < (select avg (salary)
   from instructor);
C.
Code:
   Update instructor
   set salary = case
   when salary <= 100000 then salary * 1.03
   else salary * 1.05
   end
D. None of the mentioned
 
Answer: a
Explanation: The order of the two update statements is important. If we changed the order of the two statements, an instructor with a salary just under $100,000 would receive an over 8 percent raise. SQL provides a case construct that we can use to perform both the updates with a single update statement, avoiding the problem with the order of updates.
 

Tìm kiếm

Back
Top