3.17

Consider the employee database of Figure 3.19. Give an expression in SQL for each of the following queries.

  1. Give all employees for “First Bank Corporation” a 10 percent raise.
  2. Give all managers of “First Bank Corporation” a 10 percent raise.
  3. Delete all tuples in the works relation for employees of “Small Bank Corporation”.

  1. Give all employees for “First Bank Corporation” a 10 percent raise.
UPDATE works 
SET salary = salary * 1.1
WHERE company_name = 'First Bank Corporation'
  1. Give all managers of “First Bank Corporation” a 10 percent raise.
UPDATE works
SET salary = salary * 1.1
WHERE company_name = 'First Bank Corporation' AND id IN (
    SELECT manager_id
    FROM manages
)
  1. Delete all tuples in the works relation for employees of “Small Bank Corporation”.
DELETE FROM works
WHERE company_name = 'Small Bank Corporation'