Presentation is loading. Please wait.

Presentation is loading. Please wait.

Transforming Entity-Relationship Models Into Relational Database Implementations.

Similar presentations


Presentation on theme: "Transforming Entity-Relationship Models Into Relational Database Implementations."— Presentation transcript:

1 Transforming Entity-Relationship Models Into Relational Database Implementations

2 Two Simple Rules for Transforming an ERD into Tables 1.Every entity will be a table. 2.A relationship will be a table only if: a.It is a many to many relationship or b.It has its own attributes.

3 Placement of Foreign Keys In a Transformation One to Many: The primary key from “One” table is used as the foreign key in the “Many” table. One to One: The primary key from one of the “One” table is used as the foreign key in the other “One” table. Many to Many: The relationship becomes a “bridge” table and the primary key from each of the “Many” tables is used as a foreign key. All of the foreign keys collectively become the composite primary key of the new linking table.

4 Binary One to Many PUBLISHER ( Pnum, Name, Addr ) BOOK ( ISBN, Title, Edition, Pnum )

5 Binary One to One STATE ( Code, Name, Size ) GOVERNOR ( SSN, Name, BDate, Code ) or STATE ( Code, Name, Size, SSN ) GOVERNOR ( SSN, Name, BDate )

6 Binary Many to Many STUDENT ( Snum, Name, Addr ) COURSE ( Cnum, CTitle, CrHrs ) TAKES ( Snum, Cnum, Term )

7 Unary One to One EMPLOYEE ( Enum, Name, SpouseEnum )

8 Unary One to Many EMPLOYEE ( Enum, Name, MgrEnum )

9 Unary Many to Many PART ( Pnum, Name ) ASSEMBLY ( Anum, Pnum )

10 Ternary PART ( Pnum, Pname ) SUPPLIER ( Snum, SName) WAREHOUSE ( Wnum, City ) SHIPSTO ( Pnum, Snum, WNum )

11 Composite Entity STUDENT ( Snum, Name, Addr ) COURSE ( Cnum, CTitle, CrHrs ) TAKES ( Enum, Snum, Cnum, Term )

12 Supertype-Subtype STUDENT ( PID, Major ) GRADUATE ( PID, Thesis ) UNDERGRADUATE ( PID, Hours )


Download ppt "Transforming Entity-Relationship Models Into Relational Database Implementations."

Similar presentations


Ads by Google