 Keys are special fields that serve two main purposes: ◦ Primary keys are unique identifiers of the relation in question. Examples include employee numbers,

Slides:



Advertisements
Similar presentations
Chapter 4: The Enhanced ER Model and Business Rules
Advertisements

1 Chapter 4 The Enhanced ER Model and Business Rules.
Basic notation for supertype/subtype relationships
Enhanced Entity-Relationship Modeling. Strong and Weak Entity Types Strong entity: Each object is uniquely identifiable using primary key of that entity.
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 3: The Enhanced E-R Model Modern Database Management 10 th Edition Jeffrey A. Hoffer,
Chapter 3  Define terms  Understand use of supertype/subtype relationships  Understand use of specialization and generalization techniques  Specify.
1 © Prentice Hall, 2002 Chapter 4: The Enhanced E-R Model and Business Rules Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott,
Chapter 3 © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 CHAPTER 4: THE ENHANCED E-R MODEL Modern Database Management 11 th Edition Jeffrey.
1 Logical Database Design and the Relational Model Modern Database Management.
CHAPTER 3: THE ENHANCED E-R MODEL © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition Jeffrey A. Hoffer,
Database Design & Mapping
1 © Prentice Hall, 2002 Chapter 4: The Enhanced E-R Model and Business Rules Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott,
DATABASE APPLICATION DEVELOPMENT SAK 3408 Database Design II (week 3)
Systems Development Life Cycle
© 2005 by Prentice Hall 1 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 7 th Edition Jeffrey A. Hoffer, Mary B.
Chapter 4 © 2005 by Prentice Hall 1 Objectives Definition of terms Definition of terms Use of supertype/subtype relationships Use of supertype/subtype.
Chapter 4: Logical Database Design and the Relational Model
Chapter 4: The Enhanced ER Model and Business Rules
Information Resources Management February 13, 2001.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
Data Modeling Advanced Concepts.
Enhanced Entity-Relationship Modeling
Mapping from E-R Model to Relational Model Yong Choi School of Business CSUB.
The Enhanced E-R (EER) Model
IS 4420 Database Fundamentals Chapter 4: The Enhanced ER Model and Business Rules Leon Chen.
Chapter 4: The Enhanced E-R Model and Business Rules
Chapter 3: The Enhanced E-R Model
1 Chapter 4: The Enhanced ER Model and Business Rules.
© 2007 by Prentice Hall (Hoffer, Prescott & McFadden) 1 The Relational Model (Advanced)
Chapter 5 1 © Prentice Hall, 2002 Chapter 5: Transforming EER Diagrams into Relations Mapping Regular Entities to Relations 1. Simple attributes: E-R attributes.
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 3: The Enhanced E-R Model Modern Database Management 10 th Edition Jeffrey A. Hoffer,
© 2007 by Prentice Hall (Hoffer, Prescott & McFadden) 1 The Enhanced Entity Relationship Diagrams (E-ERDs)
IS 475/675 - Introduction to Database Design
Chapter 4 1 Chapter 4: The Enhanced ER Model and Business Rules Modern Database Management Jeffrey A. Hoffer, Mary B. Prescott, Fred R. McFadden.
CS 370 Database Systems Lecture 9 The Relational model.
Chapter 9: Logical Database Design and the Relational Model (ERD Mapping)
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
1 The Enhanced Entity Relationship Diagrams (E-ERDs)
Chapter 3: The Enhanced E-R Model
CHAPTER 3: THE ENHANCED E-R MODEL © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition Jeffrey A. Hoffer,
© 2011 Pearson Education 1 Chapter 3: Advanced Database Analysis Modern Database Management 10 th Edition, International Edition Jeffrey A. Hoffer, V.
CHAPTER 3: THE ENHANCED E-R MODEL © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition Jeffrey A. Hoffer,
Database Systems Supertypes and Subtypes Lecture # 10.
Database Management System Prepared by Dr. Ahmed El-Ragal Reviewed & Presented By Mr. Mahmoud Rafeek Alfarra College Of Science & Technology- Khan younis.
Entity Relationship Modeling
Enhanced Entity-Relationship Modeling
Logical Database Design and the Relational Model.
1 ER Modeling BUAD/American University Mapping ER modeling to Relationships.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 4: The Enhanced E-R Model and Business Rules Modern Database Management 9 th Edition.
1 © Prentice Hall, 2002 ITD1312 Database Principles Chapter 4B: Logical Design for Relational Systems -- Transforming ER Diagrams into Relations Modern.
Logical Database Design and the Relational Model.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 5 (Part a): Logical Database Design and the Relational Model Modern Database Management.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 4: The Enhanced E-R Model Modern Database Management 9 th Edition Jeffrey A. Hoffer,
Advance Database Engineering 1 Chapter 4: The Enhanced ER Model and Business Rules Modern Database Management 7 th Edition Jeffrey A. Hoffer, Mary B. Prescott,
Copyright © 2016 Pearson Education, Inc. Modern Database Management 12 th Edition Jeff Hoffer, Ramesh Venkataraman, Heikki Topi CHAPTER 3: THE ENHANCED.
Lecture 4: Logical Database Design and the Relational Model 1.
Lecture # 14 Chapter # 5 The Relational Data Model and Relational Database Constraints Database Systems.
Converting ER/EER to logical schema; physical design issues 1.
© 2005 by Prentice Hall 1 Chapter 4: The Enhanced ER Model and Business Rules Modern Database Management 7 th Edition Jeffrey A. Hoffer, Mary B. Prescott,
The Enhanced E-R Model and Business Rules
LECTURE 4: Chapter 4: The Enhanced E-R Model
Advanced Database Analysis
Chapter 4: The Enhanced E-R Model and Business Rules
Chapter 4 Logical Database Design and the Relational Model
Chapter 4: Logical Database Design and the Relational Model
Chapter 4: The Enhanced ER Model and Business Rules
Chapter 4: Part B Logical Database Design and the Relational Model
Chapter 5: Logical Database Design and the Relational Model
Overview of Entity‐Relationship Model
CHAPTER 4: LOGICAL DATABASE DESIGN AND THE RELATIONAL MODEL
Presentation transcript:

 Keys are special fields that serve two main purposes: ◦ Primary keys are unique identifiers of the relation in question. Examples include employee numbers, social security numbers, etc. This is how we can guarantee that all rows are unique ◦ Foreign keys are identifiers that enable a dependent relation (on the many side of a relationship) to refer to its parent relation (on the one side of the relationship)  Keys can be simple (a single field) or composite (more than one field)  Keys usually are used as indexes to speed up the response to user queries 2

3 Primary Key Foreign Key (implements 1:N relationship between customer and order) Combined, these are a composite primary key (uniquely identifies the order line)…individually they are foreign keys (implement M:N relationship between order and product)

 Domain Constraints ◦ Allowable values for an attribute.  Entity Integrity ◦ No primary key attribute may be null. All primary key fields MUST have data  Action Assertions ◦ Business rules. 4

Mapping Regular Entities to Relations 1.Simple attributes: E-R attributes map directly onto the relation 2.Composite attributes: Use only their simple, component attributes 3.Multivalued Attribute - Becomes a separate relation with a foreign key taken from the superior entity 5

6 (a) CUSTOMER entity type with simple attributes Figure 5-8: Mapping a regular entity (b) CUSTOMER relation

7 (a) CUSTOMER entity type with composite attribute Mapping a composite attribute (b) CUSTOMER relation with address detail

8 Figure 5-10: Mapping a multivalued attribute 1–to–many relationship between original entity and new relation (a) Multivalued attribute becomes a separate relation with foreign key (b)

Mapping Weak Entities ◦ Becomes a separate relation with a foreign key taken from the superior entity ◦ Primary key composed of:  Partial identifier of weak entity  Primary key of identifying relation (strong entity) 9

10

11 NOTE: the domain constraint for the foreign key should NOT allow null value if DEPENDENT is a weak entity Foreign key Composite primary key

Mapping Unary Relationships ◦ One-to-Many - Recursive foreign key in the same relation ◦ Many-to-Many - Two relations:  One for the entity type  One for an associative relation in which the primary key has two attributes, both taken from the primary key of the entity 12

13 Mapping a unary 1:N relationship (a) EMPLOYEE entity with Manages relationship (b) EMPLOYEE relation with recursive foreign key

14 Figure 5-18: Mapping a unary M:N relationship (a) Bill-of-materials relationships (M:N) (b) ITEM and COMPONENT relations

16 Mapping the ternary relationship Remember that the primary key MUST be unique

 Supertype:A sub grouping of the entities in an entity type which has attributes that are distinct from those in other sub groupings  Supertype: An generic entity type that has a relationship with one or more subtypes

 Relationships at the supertype level indicate that all subtypes will participate in the relationship  The instances of a subtype may participate in a relationship unique to that subtype. In this situation, the relationship is shown at the subtype level

Both outpatients and resident patients are cared for by a responsible physician Only resident patients are assigned to a bed

22 Supertype/subtype relationships

23 Mapping Supertype/subtype relationships to relations These are implemented as one-to-one relationships

 Generalization: The process of defining a more general entity type from a set of more specialized entity types. BOTTOM-UP  Specialization: The process of defining one or more subtypes of the supertype, and forming supertype/subtype relationships. TOP-DOWN

All these types of vehicles have common attributes

So we put the shared attributes in a supertype

 Completeness Constraints : Whether an instance of a supertype must also be a member of at least one subtype ◦ Total Specialization Rule: Yes (double line) ◦ Partial Specialization Rule: No (single line)

Total specialization rule A patient must be either an outpatient or a resident patient

 Disjointness Constraints : Whether an instance of a supertype may simultaneously be a member of two (or more) subtypes ◦ Disjoint Rule: An instance of the supertype can be only ONE of the subtypes ◦ Overlap Rule: An instance of the supertype could be more than one of the subtypes

A simple attribute with different possible values indicating the subtype

A composite attribute with sub-attributes indicating “yes” or “no” to determine whether it is of each subtype