Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See www.db-book.com for conditions on re-usewww.db-book.com Chapter 7: Entity-Relationship.

Similar presentations


Presentation on theme: "Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See www.db-book.com for conditions on re-usewww.db-book.com Chapter 7: Entity-Relationship."— Presentation transcript:

1 Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See www.db-book.com for conditions on re-usewww.db-book.com Chapter 7: Entity-Relationship Model

2 ©Silberschatz, Korth and Sudarshan7.2Database System Concepts - 6 th Edition Chapter 7: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram Design Issues Weak Entity Sets Extended E-R Features Design of the Bank Database Reduction to Relation Schemas Database Design UML

3 ©Silberschatz, Korth and Sudarshan7.3Database System Concepts - 6 th Edition Modeling An entity is an object Example: specific person, company Entities have attributes Example: Entity: person Attributes: name, addresse

4 ©Silberschatz, Korth and Sudarshan7.4Database System Concepts - 6 th Edition Entities instructor and student instructor_ID instructor_name student-ID student_name

5 ©Silberschatz, Korth and Sudarshan7.5Database System Concepts - 6 th Edition Relationship Sets A relationship is an association between entities Example: 44553 (Peltier) advisor 22222 (Einstein) student entityrelationship instructor entity

6 ©Silberschatz, Korth and Sudarshan7.6Database System Concepts - 6 th Edition Relationship advisor

7 ©Silberschatz, Korth and Sudarshan7.7Database System Concepts - 6 th Edition Degree of a Relationship Set binary relationship involve two entity sets (or degree two).

8 ©Silberschatz, Korth and Sudarshan7.8Database System Concepts - 6 th Edition Attributes Example: instructor = (ID, name, street, city, salary ) course= (course_id, title, credits) Attribute types: Simple and composite attributes.

9 ©Silberschatz, Korth and Sudarshan7.9Database System Concepts - 6 th Edition Composite Attributes

10 ©Silberschatz, Korth and Sudarshan7.10Database System Concepts - 6 th Edition Mapping Cardinality Constraints For a binary relationship set the mapping cardinality must be one of the following types: One to one One to many Many to one Many to many

11 ©Silberschatz, Korth and Sudarshan7.11Database System Concepts - 6 th Edition Mapping Cardinalities One to one One to many

12 ©Silberschatz, Korth and Sudarshan7.12Database System Concepts - 6 th Edition Mapping Cardinalities Many to one Many to many

13 ©Silberschatz, Korth and Sudarshan7.13Database System Concepts - 6 th Edition E-R Diagrams

14 ©Silberschatz, Korth and Sudarshan7.14Database System Concepts - 6 th Edition Relationship Sets with Attributes

15 ©Silberschatz, Korth and Sudarshan7.15Database System Concepts - 6 th Edition Cardinality Constraints (  ) : “one,” (—): “many,”

16 ©Silberschatz, Korth and Sudarshan7.16Database System Concepts - 6 th Edition One-to-One Relationship one-to-one relationship between an instructor and a student

17 ©Silberschatz, Korth and Sudarshan7.17Database System Concepts - 6 th Edition One-to-Many Relationship one-to-many relationship between an instructor and a student

18 ©Silberschatz, Korth and Sudarshan7.18Database System Concepts - 6 th Edition Many-to-One Relationships In a many-to-one relationship between an instructor and a student,

19 ©Silberschatz, Korth and Sudarshan7.19Database System Concepts - 6 th Edition Many-to-Many Relationship

20 Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See www.db-book.com for conditions on re-usewww.db-book.com How about doing an ER design interactively on the board? Suggest an application to be modeled.

21 ©Silberschatz, Korth and Sudarshan7.21Database System Concepts - 6 th Edition Weak Entity Sets An entity set that does not have a primary key is referred to as a weak entity set. The existence of a weak entity set depends on the existence of a identifying entity set It must relate to the identifying entity set via a total, one-to-many relationship set from the identifying to the weak entity set Identifying relationship depicted using a double diamond The discriminator (or partial key) of a weak entity set is the set of attributes that distinguishes among all the entities of a weak entity set. The primary key of a weak entity set is formed by the primary key of the strong entity set on which the weak entity set is existence dependent, plus the weak entity set’s discriminator.

22 ©Silberschatz, Korth and Sudarshan7.22Database System Concepts - 6 th Edition Weak Entity Sets (Cont.) We underline the discriminator of a weak entity set with a dashed line. We put the identifying relationship of a weak entity in a double diamond. Primary key for section – (course_id, sec_id, semester, year)

23 ©Silberschatz, Korth and Sudarshan7.23Database System Concepts - 6 th Edition Weak Entity Sets (Cont.) Note: the primary key of the strong entity set is not explicitly stored with the weak entity set, since it is implicit in the identifying relationship. If course_id were explicitly stored, section could be made a strong entity, but then the relationship between section and course would be duplicated by an implicit relationship defined by the attribute course_id common to course and section

24 ©Silberschatz, Korth and Sudarshan7.24Database System Concepts - 6 th Edition Extended ER Features

25 ©Silberschatz, Korth and Sudarshan7.25Database System Concepts - 6 th Edition Extended E-R Features: Specialization Top-down design process; A triangle component labeled ISA (E.g., instructor “is a” person). Attribute inheritance

26 ©Silberschatz, Korth and Sudarshan7.26Database System Concepts - 6 th Edition Specialization Example

27 ©Silberschatz, Korth and Sudarshan7.27Database System Concepts - 6 th Edition Extended ER Features: Generalization A bottom-up design process Specialization and generalization are represented in an E-R diagram in the same way.

28 Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See www.db-book.com for conditions on re-usewww.db-book.com End of Chapter 7


Download ppt "Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See www.db-book.com for conditions on re-usewww.db-book.com Chapter 7: Entity-Relationship."

Similar presentations


Ads by Google