DB Exercise 2 SQL 1
DB Exercise 2 SQL 1
a. department
b. course
c. instructor
d. time_slot
SELECT p.a1
FROM p, r1, r2
WHERE p.a1 = r1.a1 or p.a1 = r2.a1
Under what conditions does the preceding query select values of p.a1 that are either in r1 or in r2?
Examine carefully the cases where one of r1 or r2 may be empty.
a. Find the names and cities of residence of all employees who work for First Bank Corporation.
b. Find the names, street addresses, and cities of residence of all employees who work for First
Bank Corporation and earn more than $10,000.
c. Assume that the companies may be located in several cities. Find all companies located in
every city in which Small Bank Corporation is located.
d. Find the company that has the most employees.
e. Find those companies whose employees earn a higher salary, on average, than the average
salary at First Bank Corporation.
f. Find all employees in the database who do not work for First Bank Corporation.
g. Find all employees in the database who earn more than each employee of Small Bank
Corporation.