ER & EER to Relational Mapping

ER & EER to Relational Mapping

Chapter 9

1

Figure 3.2 ER schema diagram for the company database.

Fname

Minit

Lname

S__s_n Bdate

Name

Address

Sex

Salary

EMPLOYEE

supervisor

1

SUPERVISION

supervisee N

N

1

WORKS_FOR

Number

Name

Locations

StartDate

NumberOfEmployees

1

1

MANAGES

DEPARTMENT

1

CONTROLS

Hours N

WORKS_ON 1

DEPENDENTS_OF

N

PROJECT

Name N__u_m_b_e_r

Location

N

DEPENDENT

Name

Sex

BirthDate

Relationship

? Addison Wesley Longman, Inc. 2000, Elmasri/Navathe, Fundamentals of Database Systems, Third Edition

Step 1: For each regular entity type E

? Create a relation R that includes all the simple attributes of E.

? Include all the simple component attributes of composite attributes.

? Choose one of the key attributes of E as primary key for R.

? If the chosen key of E is composite, the set of simple attributes that form it will together form the primary key of R.

Chapter 9

2

Figure 7.5 Schema diagram for the COMPANY relational database schema; the primary keys are underlined.

EMPLOYEE FNAME MINIT

LNAME SSN BDATE ADDRESS

SEX SALARY SUPERSSN DNO

DEPARTMENT DNAME DNUMBER

MGRSSN

MGRSTARTDATE

DEPT_LOCATIONS DNUMBER DLOCATION

PROJECT PNAME PNUMBER

PLOCATION

DNUM

WORKS_ON ESSN PNO HOURS

DEPENDENT ESSN DEPENDENT_NAME

SEX BDATE RELATIONSHIP

? Addison Wesley Longman, Inc. 2000, Elmasri/Navathe, Fundamentals of Database Systems, Third Edition

Step 2: For each weak entity type W with owner entity type E

? Create a relation R, and include all simple attributes and simple components of composite attributes of W as attributes of R.

? In addition, include as foreign key attributes of R the primary key attribute(s) of the relation(s) that correspond to the owner entity type(s).

Chapter 9

3

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download