Solution4(database)

Post on 28-Jan-2015

104 views 1 download

Tags:

description

 

Transcript of Solution4(database)

1

Figure 2-8: Entity with a multivalued attribute (Skill) and derived attribute (Years_Employed)

2

Ch 4: Problems and Exercises 1a

Employee_ID Employee_Name Address Date_Employed

Employee_ID Skill

EMPLOYEE_SKILL

EMPLOYEE

3

Fig 2-9b: Composite key attribute

4

Ch 4: Problems and Exercises 1b

Flight_Number Date Number_of_Passengers

FLIGHT

5

Fig 2-11a: A binary relationship with an attribute

6

Ch 4: Problems and Exercises 1c

Employee_ID Employee_Name

EMPLOYEE

Employee_ID Course_ID Date_Completed

COMPLETION

COURSECourse_ID Course_Title

7

Fig 2-11b: An associative entity (CERTIFICATE)

8

Ch 4: Problems and Exercises 1d

Employee_ID Employee_Name

EMPLOYEE

Certificate_Number Employee_ID Course_ID Date_Completed

CERTIFICATE

COURSE Course_ID Course_Title

9

Fig 2-15a: Unary relationship

COURSE

Course_Title

Course_ID

Is_prerequisite_

for

10

Ch 4: Problems and Exercises 1e

Course_IDCOURSE

Course_ID Prerequisite_IDCOURSE_PREREQUISITE

Course_Title

11

Fig 2-16 (b) Relationship with cardinality constraints

Note: The diagram is incomplete. Usually, there will be other non-key attributes for the entities.

12

Movie_Name

MOVIE

Copy_Number Movie_Name

VIDEOTAPE

Ch 4: Problems and Exercises 1g

13

Fig 2-19: Example of time stamping

14

Ch 4: Problems and Exercises 1h

Product_IDPRODUCT

Product_ID Effective_Date PricePRODUCT_PRICE

15

Figure 3-6b: Partial specialization rule

Note: The diagram is incomplete. It is missing the subtype discriminator.

16

Ch 4: Problems and Exercises 2a

Vehicle_ID Price Make Model Engine_Displacement

VEHICLE

C_Vehicle_ID No_of_Passengers

CAR

T_Vehicle_ID Car_Type Capacity

TRUCK

17

(a) Disjoint rule

Figure 3-7: Examples of disjointness constraints

Note: The diagram is incomplete. It is missing the subtype discriminator.

18

Ch 4: Problems and Exercises 2b

Physician_ID

RESPONSIBLE_PHYSICIAN

Patient_ID Admit_Date Physician_IDPATIENT

O_Patient_ID Checkback_Date

OUTPATIENT

R_Patient_ID

RESIDENT_PATIENT

Bed_ID

BED

Patient_Name

Date_Discharged Bed_ID

19

Figure 3-9: Subtype discriminator (overlap rule)

Note: The diagram is incomplete. There should be unique attributes for the subtypes.

20

Ch 4: Problems and Exercises 2c

Part_No Description Location Manufactured? Purchased? Qty_on_Hand

PART

M_Part_No

MANUFACTURED_PART

P_Part_No

PURCHASED_PART

P_Part_No Supplier_ID Unit_Price

SUPPLY_LINE

Supplier_ID Supplier_Name

SUPPLIER

21

Figure 3-10: Example of supertype/subtype hierarchy

Note: The diagram is incomplete and missing the subtype discriminators.

22

Ch 4: Problems and Exercises 2d

SSN Name Address Gender Date_of_Birth

PERSON

E_SSN Salary Date_Hired

EMPLOYEE

F_SSN Rank

FACULTY

S_SSN Position

STAFF

ALUMNUS

A_SSN

ST_SSN Major_Dept

STUDENT

UNDERGRAD

US_SSN Class_Standing

A_SSN Degree Year Date

DEGREES

GS_SSN Test_Score

GRADUATE

Ch 4: Problems and Exercises 13a

23

Parking Ticket table in 1NF

Ch 4: Problems and Exercises 13b

24

Functional Dependencies of the Parking Ticket table – 1NF

PARKING

Ch 4: Problems and Exercises 13c

25

Functional Dependencies of the Parking Ticket table – 2NF

STID

Ch 4: Problems and Exercises 13d

26

Functional Dependencies of the Parking Ticket table – 3NF

STID