Database Processing Eighth Edition Database Design Using Entity
Database Processing Eighth Edition Database Design Using Entity. Relationship Models Chapter 6 David M. Kroenke 1 © 2002 by Prentice Hall
Entities & Relationships • Entities are those things that users want to track • Relationships define how entities are associated with each other 2 © 2002 by Prentice Hall
Representing an Entity 3 © 2002 by Prentice Hall
Representing an Entity in DK/NF 4 © 2002 by Prentice Hall
Entity with Appropriate Normalization 5 © 2002 by Prentice Hall
Representing a ‘Has-a’ Relationship • 1: 1 and 1: N relationships are saved by creating foreign keys • A foreign key is when you take the primary key from one table (on the one-side) and place it into another table (on the many-side or into the other table for a 1: 1 relationship) 6 © 2002 by Prentice Hall
Representing a 1: 1 Relationship • The foreign key can go on either side BUT it is on one side only 7 © 2002 by Prentice Hall
Representing 1: N Relationships • In each of the following examples, the foreign key goes to the right (into the many-side) 8 © 2002 by Prentice Hall
Foreign Key Placement • Professor. Name goes into the Student table as a Foreign Key 9 © 2002 by Prentice Hall
Representing a N: M Relationship • N: M relationships are saved by creating a new table. • The primary key of the new table is a combination key composed of the primary keys from each of the tables involved in the relationship. 10 © 2002 by Prentice Hall
Representing a M: N Relationship 11 © 2002 by Prentice Hall
An E-R Diagram Example 12 © 2002 by Prentice Hall
The Representation of the E -R Diagram Example on previous slide 13 © 2002 by Prentice Hall
Common Relationship Patterns • • Tree Simple Networks Complex Networks Bills of Materials 14 © 2002 by Prentice Hall
Tree Relationship Pattern • A tree relationship pattern is a form of hierarchy – The data structure elements have only one-to-many relationships 15 © 2002 by Prentice Hall
A Tree Relationship Example 16 © 2002 by Prentice Hall
Simple Network Relationship Pattern • A simple network relationship pattern data structure has only 1: N relationships. • The elements may have more than one parent as long as the parents are of different types 17 © 2002 by Prentice Hall
Example of a Simple Network Relationship Pattern 18 © 2002 by Prentice Hall
A Complex Network Relationship Pattern • A complex network relationship pattern is where the data structure has at least one N: M relationship 19 © 2002 by Prentice Hall
Example of a Complex Network Relationship Pattern 20 © 2002 by Prentice Hall
Bills of Materials Relationship Patterns • Bills of materials relationship patterns are data structures that occur frequently in manufacturing applications. Parent relations are viewed as composites of the child relations. 21 © 2002 by Prentice Hall
Example of a Bills of Material Relationship Pattern 22 © 2002 by Prentice Hall
Database Processing Eighth Edition Database Design Using Entity. Relationship Models Chapter 6 David M. Kroenke 23 © 2002 by Prentice Hall
- Slides: 23