Chapter 6: Entity-Relationship Model. E-R Diagrams

Similar documents
Chapter 6: Entity-Relationship Model

Chapter 6: Entity-Relationship Model

Chapter 2: Entity-Relationship Model

Chapter 6: Entity-Relationship Model

Chapter 6: Entity-Relationship Model. The Next Step: Designing DB Schema. Identifying Entities and their Attributes. The E-R Model.

The Next Step: Designing DB Schema. Chapter 6: Entity-Relationship Model. The E-R Model. Identifying Entities and their Attributes.

Design Process Modeling Constraints E-R Diagram Design Issues Weak Entity Sets Extended E-R Features Design of the Bank Database Reduction to

6.1 RELATIONSHIP CONCEPTS

Chapter 2: Entity-Relationship Model. Entity Sets. Entity Sets customer and loan. Attributes. Relationship Sets. A database can be modeled as:

Lecture 14 of 42. E-R Diagrams, UML Notes: PS3 Notes, E-R Design. Thursday, 15 Feb 2007

Example: specific person, company, event, plant

Chapter 6: Entity-Relationship Model

Intro to DB CHAPTER 6

Chapter 7: Entity-Relationship Model

Chapter 7: Entity-Relationship Model

A database can be modeled as: + a collection of entities, + a set of relationships among entities.

Chapter 7: Entity-Relationship Model

Entity-Relationship Model

Chapter 7: Entity-Relationship Model. Chapter 7: Entity-Relationship Model

Chapter 7: Entity-Relationship Model

Roadmap of This Lecture. Weak Entity Sets Extended E-R Features Reduction to Relation Schemas Database Design UML*

The En'ty Rela'onship Model

UNIT II A. ENTITY RELATIONSHIP MODEL

CSIT5300: Advanced Database Systems

Lecture 10 - Chapter 7 Entity Relationship Model

Database Systems. Lecture2:E-R model. Juan Huo( 霍娟 )

Unit1: Introduction. Database System Concepts, 6 th Ed. Silberschatz, Korth and Sudarshan See for conditions on re-use

COMP Instructor: Dimitris Papadias WWW page:

VARDHAMAN COLLEGE OF ENGINEERING Shamshabad , Hyderabad B.Tech. CSE IV Semester (VCE - R11) T P C 3+1* -- 4 (A1511) DATABASE MANAGEMENT SYSTEMS

Database Management Systems LECTURE NOTES 2

Database Management System 10 Conversion of ER model to Relational Model

2. E-R Model. Entity Sets Relationship Sets Attributes

Unit I. By Prof.Sushila Aghav MIT

Entity-Relationship Modelling. Entities Attributes Relationships Mapping Cardinality Keys Reduction of an E-R Diagram to Tables

CSIT5300: Advanced Database Systems

Topic 5: Mapping of EER Diagrams to Relations

Databases Tutorial. January 19,2012 Jing Chen Mcmaster University

Chapter 9: Relational DB Design byer/eer to Relational Mapping Relational Database Design Using ER-to- Relational Mapping Mapping EER Model

CSCC43H: Introduction to Databases

LELCTURE 4: ENHANCED ENTITY-RELATIONSHIP MODELING (EER)

More on the Chen Notation

ER to Relational Mapping

Database Design and the E-R Model (7.4, )

COMP 244. ER-Diagram Notations. Entity-Relationship Diagrams DATABASE CONCEPTS & APPLICATIONS. Database Concepts & Applications 1.

UNIT - 1 INTRODUCTION TO DATA BASE

Information Systems and Software Systems Engineering (12CFU)

The Entity Relationship Model

The Entity-Relationship Model. Steps in Database Design

COMP 244 DATABASE CONCEPTS & APPLICATIONS

ER DIAGRAM ER) diagram, a graphical representation of entities and their relationships to each other, typically used in computing in regard to the

Major components of ER diagram Practices

Using High-Level Conceptual Data Models for Database Design A Sample Database Application Entity Types, Entity Sets, Attributes, and Keys

Overview of Database Design Process Example Database Application (COMPANY) ER Model Concepts


Comp 5311 Database Management Systems. 2. Relational Model and Algebra

DBMS: AN INTERACTIVE TUTORIAL

Chapter 6: Relational Database Design

Relational DB Design by ER- and EER-to-Relational Mapping Design & Analysis of Database Systems

Chapter (4) Enhanced Entity-Relationship and Object Modeling

Data Modeling with the Entity Relationship Model. CS157A Chris Pollett Sept. 7, 2005.

Conceptual Design. The Entity-Relationship (ER) Model

Chapter Outline. Note 1. Overview of Database Design Process Example Database Application (COMPANY) ER Model Concepts

Chapter 7 Relational Database Design by ER- and EERR-to-Relational Mapping

MTAT Introduction to Databases

SE 4DB3 TUTORIAL 2: REDUCTION TO RELATIONAL SCHEMAS

1/24/2012. Chapter 7 Outline. Chapter 7 Outline (cont d.) CS 440: Database Management Systems

Entity-Relationship Model &

DATABASE DESIGN I - 1DL300

Conceptual Data Modeling

ENTITY-RELATIONSHIP MODEL II. CS121: Relational Databases Fall 2017 Lecture 15

DATABASE SCHEMA DESIGN ENTITY-RELATIONSHIP MODEL. CS121: Relational Databases Fall 2017 Lecture 14

A l Ain University Of Science and Technology

ER-to-Relational Mapping

Database Management System 6 ER Modeling...

Chapter 7: Relational Database Design

ENTITY-RELATIONSHIP MODEL III. CS121: Relational Databases Fall 2017 Lecture 16

CMPT 354 Database Systems I

Database Systems ER Model. A.R. Hurson 323 CS Building

Conceptual Modeling in ER and UML

Ch 9: Mapping EER to Relational. Follow a seven-step algorithm to convert the basic ER model constructs into relations steps 1-7

Chapter 2 ENTITY RELATIONSHIP MODEL

A l Ain University Of Science and Technology

Entity Relationship Data Model. Slides by: Shree Jaswal

Entity Relationship(ER) Modelling

Outline. Note 1. CSIE30600 Database Systems ER/EER to Relational Mapping 2

Database Management

CS425 Fall 2013 Boris Glavic Chapter 7: Entity-Relationship Model!

Data Modeling Using the Entity-Relationship (ER) Model

DATABASE TECHNOLOGY - 1DL124

Chapter 3 The Enhanced E-R Model

Chapter 3 Database Modeling and Design II. Database Modeling

FINAL EXAM REVIEW. CS121: Introduction to Relational Database Systems Fall 2018 Lecture 27

E-R Model. Hi! Here in this lecture we are going to discuss about the E-R Model.

Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition. Chapter 7 Data Modeling with Entity Relationship Diagrams

OVERVIEW OF DATABASE DEVELOPMENT

Overview of Database Design Process. Data Modeling Using the Entity- Relationship (ER) Model. Two main activities:

MIS Database Systems Entity-Relationship Model.

Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 4-1

Enhanced Entity- Relationship Models (EER)

Chapter 4. Enhanced Entity- Relationship Modeling. Enhanced-ER (EER) Model Concepts. Subclasses and Superclasses (1)

Transcription:

Chapter 6: Entity-Relationship Model A database can be modeled as: a collection of entities, relationship among entities. An entity is an object that exists and is distinguishable from other objects. Example: specific person, company, event, plant Entities have attributes Example: people have names and addresses An entity set is a set of entities of the same type that share the same properties. Example: set of all persons, companies, trees, holidays 1 E-R Diagrams Rectangles represent entity sets. Diamonds represent relationship sets. Lines link attributes to entity sets and entity sets to relationship sets. Underline indicates primary key attributes 2 1

E-R Diagram With Composite, Multivalued, and Derived Attributes Ellipses represent attributes Double ellipses represent multivalued attributes. Dashed ellipses denote derived attributes. 3 Relationship Sets with Attributes 4 2

Roles Entity sets of a relationship need not be distinct The labels manager and worker are called roles; they specify how employee entities interact via the works_for relationship set. Roles are indicated in E-R diagrams by labeling the lines that connect diamonds to rectangles. Role labels are optional, and are used to clarify semantics of the relationship 5 One-To-Many Relationship In the one-to-many relationship a loan is associated with at most one customer via borrower, a customer is associated with several (including 0) loans via borrower 6 3

Many-To-One Relationships In a many-to-one relationship a loan is associated with several (including 0) customers via borrower, a customer is associated with at most one loan via borrower 7 Many-To-Many Relationship A customer is associated with several (possibly 0) loans via borrower A loan is associated with several (possibly 0) customers via borrower 8 4

Participation of an Entity Set in a Relationship Set Total participation (indicated by double line): every entity in the entity set participates in at least one relationship in the relationship set participation of loan in borrower is total every loan must have a customer associated to it via borrower Partial participation: some entities may not participate in any relationship in the relationship set participation of customer in borrower is partial 9 E-R Diagram with a Ternary Relationship 10 5

Converting Non-Binary Relationships to Binary Form In general, any non-binary relationship can be represented using binary relationships by creating an artificial entity set. Replace R between entity sets A, B and C by an entity set E, and three relationship sets: 1. R A, relating E and A 2.R B, relating E and B 3. R C, relating E and C 11 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. 12 6

Weak Entity Sets (Cont.) We depict a weak entity set by double rectangles. We underline the discriminator of a weak entity set with a dashed line. payment_number discriminator of the payment entity set Primary key for payment (loan_number, payment_number) 13 Extended E-R Features: Specialization Top-down design process; we designate subgroupings within an entity set that are distinctive from other entities in the set. These subgroupings become lower-level entity sets that have attributes or participate in relationships that do not apply to the higher-level entity set. Depicted by a triangle component labeled ISA (E.g. customer is a person). Attribute inheritance a lower-level entity set inherits all the attributes and relationship participation of the higher-level entity set to which it is linked. 14 7

Specialization Example 15 Extended ER Features: Generalization A bottom-up design process combine a number of entity sets that share the same features into a higher-level entity set. Specialization and generalization are simple inversions of each other; they are represented in an E-R diagram in the same way. The terms specialization and generalization are used interchangeably. 16 8

Design Constraints on a Specialization/Generalization Constraint on which entities can be members of a given lower-level entity set. condition-defined Example: all customers over 65 years are members of senior-citizen entity set; senior-citizen ISA person. user-defined Constraint on whether or not entities may belong to more than one lower-level entity set within a single generalization. Disjoint an entity can belong to only one lower-level entity set Noted in E-R diagram by writing disjoint next to the ISA triangle Overlapping an entity can belong to more than one lower-level entity set 17 Design Constraints on a Specialization/Generalization (Cont.) Completeness constraint -- specifies whether or not an entity in the higher-level entity set must belong to at least one of the lower-level entity sets within a generalization. total : an entity must belong to one of the lower-level entity sets partial: an entity need not belong to one of the lower-level entity sets 18 9

E-R Design Decisions The use of an attribute or entity set to represent an object. Whether a real-world concept is best expressed by an entity set or a relationship set. The use of a strong or weak entity set. The use of specialization/generalization contributes to modularity in the design. 19 E-R Diagram for a Banking Enterprise 20 10

Representing Entity Sets as Relation Schemas A strong entity set reduces to a schema with the same attributes. A weak entity set becomes a table that includes a column for the primary key of the identifying strong entity set loan = ( loan_number, amount ) 21 Representing Relationship Sets as Relation Schemas A many-to-many relationship set is represented as a schema with attributes for the primary keys of the two participating entity sets, and any descriptive attributes of the relationship set. Example: schema for relationship set borrower borrower = (customer_id, loan_number ) 22 11

Representing Weak Entity Sets as Relational Schemas payment = (loan_number, payment_number, payment_date, payment_amount) 23 Redundancy of Schemas Many-to-one and one-to-many relationship sets that are total on the many-side can be represented by adding an extra attribute to the many side, containing the primary key of the one side Example: Instead of creating a schema for relationship set account_branch, add an attribute branch_name to the schema arising from entity set account 24 12

Composite and Multivalued Attributes Composite attributes are flattened out by creating a separate attribute for each component attribute A multivalued attribute M of an entity E is represented by a separate schema EM Each value of the multivalued attribute maps to a separate tuple of the relation on schema EM 25 Method 1: Representing Specialization via Schemas Form a schema for the higher-level entity Form a schema for each lower-level entity set, include primary key of higher-level entity set and local attributes schema attributes person name, street, city customer name, credit_rating employee name, salary Drawback: getting information about, an employee requires accessing two relations, the one corresponding to the low-level schema and the one corresponding to the high-level schema 26 13

Representing Specialization as Schemas (Cont.) Method 2: Form a schema for each entity set with all local and inherited attributes schema person customer employee attributes name, street, city name, street, city, credit_rating name, street, city, salary If specialization is total, the schema for the generalized entity set (person) not required to store information Drawback: street and city may be stored redundantly for people who are both customers and employees 27 14