Solution4(database)

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

description

 

Transcript of Solution4(database)

Page 1: Solution4(database)

1

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

Page 2: Solution4(database)

2

Ch 4: Problems and Exercises 1a

Employee_ID Employee_Name Address Date_Employed

Employee_ID Skill

EMPLOYEE_SKILL

EMPLOYEE

Page 3: Solution4(database)

3

Fig 2-9b: Composite key attribute

Page 4: Solution4(database)

4

Ch 4: Problems and Exercises 1b

Flight_Number Date Number_of_Passengers

FLIGHT

Page 5: Solution4(database)

5

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

Page 6: Solution4(database)

6

Ch 4: Problems and Exercises 1c

Employee_ID Employee_Name

EMPLOYEE

Employee_ID Course_ID Date_Completed

COMPLETION

COURSECourse_ID Course_Title

Page 7: Solution4(database)

7

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

Page 8: Solution4(database)

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

Page 9: Solution4(database)

9

Fig 2-15a: Unary relationship

COURSE

Course_Title

Course_ID

Is_prerequisite_

for

Page 10: Solution4(database)

10

Ch 4: Problems and Exercises 1e

Course_IDCOURSE

Course_ID Prerequisite_IDCOURSE_PREREQUISITE

Course_Title

Page 11: Solution4(database)

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.

Page 12: Solution4(database)

12

Movie_Name

MOVIE

Copy_Number Movie_Name

VIDEOTAPE

Ch 4: Problems and Exercises 1g

Page 13: Solution4(database)

13

Fig 2-19: Example of time stamping

Page 14: Solution4(database)

14

Ch 4: Problems and Exercises 1h

Product_IDPRODUCT

Product_ID Effective_Date PricePRODUCT_PRICE

Page 15: Solution4(database)

15

Figure 3-6b: Partial specialization rule

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

Page 16: Solution4(database)

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

Page 17: Solution4(database)

17

(a) Disjoint rule

Figure 3-7: Examples of disjointness constraints

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

Page 18: Solution4(database)

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

Page 19: Solution4(database)

19

Figure 3-9: Subtype discriminator (overlap rule)

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

Page 20: Solution4(database)

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

Page 21: Solution4(database)

21

Figure 3-10: Example of supertype/subtype hierarchy

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

Page 22: Solution4(database)

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

Page 23: Solution4(database)

Ch 4: Problems and Exercises 13a

23

Parking Ticket table in 1NF

Page 24: Solution4(database)

Ch 4: Problems and Exercises 13b

24

Functional Dependencies of the Parking Ticket table – 1NF

PARKING

Page 25: Solution4(database)

Ch 4: Problems and Exercises 13c

25

Functional Dependencies of the Parking Ticket table – 2NF

STID

Page 26: Solution4(database)

Ch 4: Problems and Exercises 13d

26

Functional Dependencies of the Parking Ticket table – 3NF

STID