Databases
Databases
Lesson 2 Assignment
Review Questions
2. What does a database expert mean when (s)he observes that a database displays
both entity integrity and referential integrity?
4. Draw the basic entity relationship diagram for the database shown below.
5. Suppose that you have the entity relationship model shown below.
During some time interval, a DRIVER can drive many different TRUCKs
and any TRUCK can be driven by many DRIVERs
How would you convert this model into an entity relationship model that displays only
1:M relationships? (Make sure that you draw the revised entity relationship model.)
1
6. How would you implement a 1:M relationship in a database composed of two
tables? Give an example.
7. Identify and describe the components of the database table shown in Figure
Q2.70, using correct terminology. Identify the entity name, its attributes and the
primary and foreign keys.
8. Suppose that you are using the following database composed of the two tables
shown in Figure Q2.11:
Figure Q2.11
Table name: DIRECTOR
2
a. Identify the primary keys.
b. Identify the foreign key.
c. Draw the Entity Relationship Diagram.
Problems
Use the database shown in Figure P2.1 to work problems 1 through 5. Note that the
database is composed of four tables and reflects these relationships:
Note that the M:N relationship has been decomposed into two 1:M relationships for
which the BENEFIT table serves as the composite or bridge entity.
1. For each table in the database, identify the primary key and the foreign key(s). If
a table does not have a foreign key, write NONE in the assigned space.
3
TABLE PRIMARY KEY FOREIGN KEY(S)
EMPLOYEE
BENEFIT
JOB
PLAN
2. Draw the entity relationship diagram for the relationship between EMPLOYEE
and JOB.
3. Do the tables exhibit entity integrity? Answer Yes or No, then explain your
answer.
4. Do the tables exhibit referential integrity? Answer Yes or No, then explain your
answer. Write NA (Not Applicable) if the table does not have a foreign key.
4
Use the database shown in Figure P2.2 to answer problems 6-8.
6. For each table, identify the primary key and the foreign key(s). If a table does
not have a foreign key, write None in the assigned space.
7. Do the tables exhibit entity integrity? Answer Yes or No, then explain your
answer.
8. Do the tables exhibit referential integrity? Answer Yes or No, then explain your
answer. Write NA (Not Applicable) if the table does not have a foreign key.
5
PRODUCT
VENDOR
9. For each table, identify the primary key and the foreign key(s). If a table does
not have a foreign key, write NONE in the assigned space.
10. Do the tables exhibit entity integrity? Answer Yes or No, then explain your
answer.
6
TRUCK
BASE
TYPE
11. Do the tables exhibit referential integrity? Answer Yes or No, then explain your
answer. Write NA (Not Applicable) if the table does not have a foreign key.
7
Table name: CHARTER (first six attributes) Database name: L2_AVIA_CO
The destinations are indicated by standard three-letter airport codes. For example,
STL = St. Louis, MO, ATL = Atlanta, GA, BNA = Nashville, TN, and so on.
Table name: CHARTER (part 2, next four attributes, primary key values repeated to
see the connection to the first part more easily.)
8
Table name: CHARTER (Part 3, remaining attributes, primary key values repeated
to see the connection to the first and second parts more easily.)
Customers are charged per round-trip mile, using the MOD_CHG_MILE rate.
The MOD_SEAT gives the total number of seats in the airplane, including the
pilot/copilot seats. Therefore, a PA31-350 trip that is flown by a pilot and a
copilot has eight passenger seats available.
9
Table name: PILOT
The pilot licenses shown here include the ATP = Airline Transport Pilot and COM =
Commercial Pilot. Businesses that operate “on demand” air services are governed by
Part 135 of the Federal Aviation Administration (FAA). Such businesses are also
known as “Part 135 Operators.” Part 135 operations require that pilots successfully
complete a flight proficiency check each six months. The date of the “Part 135”
proficiency check is recorded under PIL_PT135_DATE. To fly commercially, pilots
must have at least a 2nd class medical certificate (PIL_MED_TYPE = 2).
10
Given this aviation database, work the following problems:
15. Create an Entity Relationship diagram. Diagram using the Crows foot model.
Hint: Take a look at the table contents. You will discover that an AIRCRAFT
can be used to fly many CHARTER trips, but that each CHARTER trip is flown
by one AIRCRAFT. Similarly, you will discover that a MODEL references many
AIRCRAFT, but each AIRCRAFT references a single MODEL, and so on.
After carefully exploring the database's contents, note the following relationships:
• a PILOT may pilot many CHARTER trips, but each CHARTER trip is
piloted by one PILOT.
11