CIS 452 - Homework #2
Due: Friday, March 13
Consider the automobile insurance sample database.
- Write relational algebra expressions to find:
- Names and ssn numbers of people who live in MA.
- Names of agents who earn a salary of more than $55,000.
- Names and ssn numbers of automobile owners who live in MA.
- Names and ssn numbers of people who own Toyotas.
- Ssn's of people who have been the driver in more than one accident.
- Names and ssn's of people who have never been in an accident.
- Names and ssn's of people in MA who do not own an automobile.
- Write SQL statements to find:
- Names and ssn numbers of people who live in MA.
- Names of agents who earn a salary of more than $55,000.
- Names and ssn numbers of automobile owners who live in MA.
- Names and ssn numbers of people who own Toyotas.
- Ssn's of people who have been the driver in more than one accident.
- Write an SQL statement to create a table, policy(pnum, vin, pdate, coverage, premium),
to record information about insurance policies, including:
- policy number (a unique identifier)
- vin number of the insured auto
- purchase date of the policy
- coverage amount
- annual premium price
- Write SQL statements to add the data shown below to the policy table.
Hint: In mysql date literals are written between single quotes in the yyyy-mm-dd format.
For example, Feb. 6, 2009 is written as '2009-02-06'. Do not include commas in number literals.
| pnum | vin | pdate | coverage | premium |
| 0238 | 8Y48P96B235K | 2007-01-31 | 15000 | 300 |
| 9421 | LW37HG894A2Z | 2005-08-03 | 9000 | 155 |
| 7632 | 5Y63HF28K9L1 | 2009-02-06 | 12000 | 247 |
- Write an SQL statement to change the coverage of policy 9421 to $11,000.
- Write an SQL statement to delete policy 7632.