3.1 Consider the insurance database of Figure 3.11, where the primary keys are underlined. Construct the following SQL queries for this relational database.
a. Find the total number of people who owned cars that were involved in accidents
b. Add a new accident to the database; assume any values for required attributes.
c. Delete the Mazda belonging to “John Smith”.
3.2 Consider the employee database of Figure 4.13, where the primary keys are underlined. Give an expression in SQL for each of the following queries.
a. Find the names and cities of residence of all employees who work for First
b. Find the names, street address, and cities of residence of all employees who
work for First Bank Corporation and earn more than $10,000.
c. Find all employees in the database who do not work for First Bank Corporation.
The following solution assumes that all people work for exactly one company.
d. Find all employees in the database who earn more than every employee of
Small Bank Corporation.
e. Assume that the companies may be located in several cities. Find all companies
located in every city in which Small Bank Corporation is located.
f. Find the company that has the most employees.
g. Find those companies whose employees earn a higher salary, on average,
than the average salary at First Bank Corporation.