1 / 12

Transforming Entity-Relationship Models Into Relational Database Implementations

Transforming Entity-Relationship Models Into Relational Database Implementations. Two Simple Rules for Transforming an ERD into Tables. Every entity will be a table. A relationship will be a table only if: It is a many to many relationship or It has its own attributes.

powa
Download Presentation

Transforming Entity-Relationship Models Into Relational Database Implementations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Transforming Entity-Relationship Models Into Relational Database Implementations

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

  3. Placement of Foreign KeysIn a Transformation One to Many: The primary key from “One” table is used as the foreign key in the “Many” table. One to One: Theprimary 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 )

More Related