Chapter 6: ER – Entity Relationship Diagram

Slides:



Advertisements
Similar presentations
Chapter 2: Entity-Relationship Model
Advertisements

Temple University – CIS Dept. CIS616– Principles of Database Systems
Chapter 6: Entity-Relationship Model (part I)
Chapter 6: ER – Entity Relationship Diagram
Entity-Relationship Model
Chapter 2: Entity-Relationship Model
Text-Book Chapters (7 and 8) Entity-Relationship Model
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
CS157A Lecture 3 ER Diagram Prof. Sin-Min Lee Department of Computer Science San Jose State University.
1 Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping Constraints Keys E-R Diagram Extended E-R Features Design of an E-R Database.
1–1 The E-R Model Prof. Sin-Min Lee Department of Computer Science.
Slides adapted from A. Silberschatz et al. Database System Concepts, 5th Ed. Entity-Relationship Model Database Management Systems I Alex Coman, Winter.
Chapter 2: Entity-Relationship Model (Continued)
Entity-Relationship Model
the Entity-Relationship Model
Database System Concepts, 5th Ed. Chapter 6: Entity-Relationship Model.
Entity-Relationship Model
Chapter 2: Database Design and Entity-Relationship Model  Database Design  Entity Sets  Relationship Sets  Design Issues  Mapping Constraints  Keys.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 6: Entity-Relationship.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Chapter 7 Database Design and The E–R Model. 2 Goals n Facilitate DB design and represent the overall logical structure of the DB. n Definition Entities.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 7: Entity-Relationship.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 6: Entity-Relationship.
Chapter 6: Entity-Relationship Model. Design Process Modeling Constraints E-R Diagram Design Issues Weak Entity Sets Extended E-R Features Design of the.
6.1 Chapter 6: Database Design and the ER Model Skip 6.5.3, 6.10, 6.11.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan Chapter 6: Entity-Relationship Model.
EXAMPLE. Subclasses and Superclasses Entity type may have sub-grouping that need to be represented explicitly. –Example: Employee may grouped into.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts DB Schema Design: the Entity-Relationship Model What’s the use of the E-R model? Entity Sets.
Entity-Relationship Model Using High-Level Conceptual Data Models for Database Design Entity Types, Sets, Attributes and Keys Relationship Types, Sets,
Initial Design of Entity Types for the COMPANY Database Schema Based on the requirements, we can identify four initial entity types in the COMPANY database:
Computing & Information Sciences Kansas State University Wednesday, 24 Sep 2008CIS 560: Database System Concepts Lecture 12 of 42 Wednesday, 24 September.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Chapter 2 : Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping Constraints Keys E-R Diagram Extended E-R Features Design of.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model ([S] Chp. 6) Entity Sets Relationship Sets Design Issues.
DATABASE MANAGEMENT SYSTEM Entity-Relationship Model.
ITTelkom Entity Relationship Diagram (1) CS2343 Perancangan Basisdata Relasional.
UNIT_2 1 DATABASE MANAGEMENT SYSTEM[DBMS] [Unit: 2] Prepared By Lavlesh Pandit SPCE MCA, Visnagar.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan Lecture-03 Introduction –Data Models Lectured by, Jesmin Akhter.
Databases Illuminated Chapter 3 The Entity Relationship Model.
ICOM 5016 – Introduction to Database Systems Lecture 5 Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
Computing & Information Sciences Kansas State University Friday, 26 Sep 2008CIS 560: Database System Concepts Lecture 13 of 42 Friday, 26 September 2008.
Keys for Relationship Sets The combination of primary keys of the participating entity sets forms a super key of a relationship set. – (customer-id, account-number)
Entity-Relation Model. E-R Model The Entity-Relationship (ER) model was originally proposed by Peter in 1976 ER model is a conceptual data model that.
Database and Information Retrieval System
 Design Process  Modeling  Constraints  E-R Diagram  Design Issues  Weak Entity Sets  Extended E-R Features  Design of the Bank Database  Reduction.
Database System Concepts, 5th Ed. Bin Mu at Tongji University Chapter 6: Entity-Relationship Model.
Data Modeling Using the Entity-Relationship (ER) Data Model.
Chapter 6: Entity-Relationship Model. Design Process Modeling Constraints E-R Diagram Design Issues Weak Entity Sets Extended E-R Features Design of the.
CST203-2 Database Management Systems Lecture 4. Student entity NIDFNameLNameRegNoExamIdBirthdate.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
1 Entity Relationship Diagram. ER proposed by Peter Chen ER diagram is widely used in database design Represent conceptual level of a database.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Mapping Constraints Keys.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Module 8: Entity-Relationship.
Lecture 26 Enterprise Systems Development ( CSC447 ) COMSATS Islamabad Muhammad Usman, Assistant Professor.
Topic 3: ER – Entity Relationship Model (ERM) 6/12/
Database System Concepts ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 6: Entity-Relationship.
Chapter 2: Entity-Relationship Model
Entity-Relationship Model
Entity Relationship Model
Entity-Relationship Model
Chapter 2: Entity-Relationship Model
Chapter 6: Entity-Relationship Model
Chapter 2: Entity-Relationship Model
Entity-Relationship Model
Chapter 6: Entity-Relationship Model
Chapter 7: Entity-Relationship Model
Entity Relation Model Tingting Zhang.
Chapter 2: Entity-Relationship Model
Presentation transcript:

Chapter 6: ER – Entity Relationship Diagram Major components of ER diagram Practices KAUSHAL BHARDWAJ 4/22/2017

ER 1976 proposed by Peter Chen ER diagram is widely used in database design Represent conceptual level of a database system Describe things and their relationships in high level KAUSHAL BHARDWAJ 4/22/2017

Basic Concepts Entity set – an abstraction of similar things, e.g. cars, students An entity set contains many entities Attributes: common properties of the entities in a entity sets Relationship – specify the relations among entities from two or more entity sets KAUSHAL BHARDWAJ 4/22/2017

An Example KAUSHAL BHARDWAJ 4/22/2017

Relationship A relationship may be thought as a set as well For binary relationship, it enumerates the pairs of entities that relate to each other For example, entity set M = {Mike, Jack, Tom} entity set F = {Mary, Kate}. The relationship set married between M and F may be {<Mike,Mary>,<Tom, Kate>} KAUSHAL BHARDWAJ 4/22/2017

Relationship A relationship set is a mathematical relation among n  2 entities, each taken from entity sets {(e1, e2, … en) | e1  E1, e2  E2, …, en  En} where (e1, e2, …, en) is a relationship Example: (Hayes, A-102)  depositor KAUSHAL BHARDWAJ 4/22/2017

Relationship Example KAUSHAL BHARDWAJ 4/22/2017

Attribute of A Relationship Set KAUSHAL BHARDWAJ 4/22/2017

Relationship The degree of a relationship = the number of entity sets that participate in the relationship Mostly binary relationships Sometimes more Mapping cardinality of a relationship 1 –1 1 – many many – 1 Many-many KAUSHAL BHARDWAJ 4/22/2017

One-One and One-Many KAUSHAL BHARDWAJ 4/22/2017

Many-one and many-many KAUSHAL BHARDWAJ 4/22/2017

1- many KAUSHAL BHARDWAJ 4/22/2017

Many - 1 KAUSHAL BHARDWAJ 4/22/2017

Many - many KAUSHAL BHARDWAJ 4/22/2017

Alternative Cardinality Specification KAUSHAL BHARDWAJ 4/22/2017

Note on Mapping Cardinality Both many and 1 include 0 Meaning some entity may not participate in the relationship KAUSHAL BHARDWAJ 4/22/2017

Total Participation When we require all entities to participate in the relationship (total participation), we use double lines to specify Every loan has to have at least one customer KAUSHAL BHARDWAJ 4/22/2017

Self Relationship Sometimes entities in a entity set may relate to other entities in the same set. Thus self relationship Here employees mange some other employees The labels “manger” and “worker” are called roles the self relationship KAUSHAL BHARDWAJ 4/22/2017

More examples on self-relationship People to people Parent – children Manager – employee Husband – wife Word to word Root – synonym KAUSHAL BHARDWAJ 4/22/2017

Attributes Both entity sets and relationships can have attributes Attributes may be Composite Multi-valued (double ellipse) Derive (dashed ellipse) KAUSHAL BHARDWAJ 4/22/2017

Another Example KAUSHAL BHARDWAJ 4/22/2017

Keys A super key of an entity set is a set of one or more attributes whose values uniquely determine each entity. A candidate key of an entity set is a minimal super key Although several candidate keys may exist, one of the candidate keys is selected to be the primary key. KAUSHAL BHARDWAJ 4/22/2017

Key Examples author death name birthday description Suggest super keys for the following entity? What are the candidate keys? Primary key? author death name birthday description KAUSHAL BHARDWAJ 4/22/2017

Ternary Relationship KAUSHAL BHARDWAJ 4/22/2017

Can We Decompose a Ternary Relationship? Some relationships that appear to be non- binary may be better represented using binary relationships E.g. A ternary relationship parents, relating a child to his/her father and mother, is best replaced by two binary relationships, father and mother Using two binary relationships allows partial information (e.g. only mother being know) But there are some relationships that are naturally non-binary E.g. works-on, why? KAUSHAL BHARDWAJ 4/22/2017

Converting Ternary to binary 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. RA, relating E and A 2.RB, relating E and B 3. RC, relating E and C Create a special identifying attribute for E Add any attributes of R to E For each relationship (ai , bi , ci) in R, create 1. a new entity ei in the entity set E 2. add (ei , ai ) to RA 3. add (ei , bi ) to RB 4. add (ei , ci ) to RC KAUSHAL BHARDWAJ 4/22/2017

Converting Ternary to binary KAUSHAL BHARDWAJ 4/22/2017

Design an ER Diagram Design a database for an on-line reservation system for microscopes in material science lab There are two types of users: microscope administrators and microscope end users Each microscope is located in a specific lab Each request is assigned to an administrator who can authorize or deny the request Using of some microscope requires the presence of an administrator Time is divided into 1 hour slots. Each reservation can only take one or more time slots KAUSHAL BHARDWAJ 4/22/2017

Weak Entity Set Some entity sets in real world naturally depend on some other entity set They can be uniquely identified only if combined with another entity set Example: section1, section2, … become unique only if you put them into a context, e.g. csce4350 KAUSHAL BHARDWAJ 4/22/2017

Weak Entity Set Notations Double rectangles for weak entity set Double diamond for weak entity relationship Dashed underscore for discriminator KAUSHAL BHARDWAJ 4/22/2017

Specialization A lower-level entity set inherits all the attributes and relationship participation of the higher-level entity set to which it is linked. A lower-level entity set may have additional attributes and participate in additional relationships KAUSHAL BHARDWAJ 4/22/2017

KAUSHAL BHARDWAJ 4/22/2017

Specification Disjoint Completeness constraint (use double lines) 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 KAUSHAL BHARDWAJ 4/22/2017

Design Considerations Use of entity sets vs. attributes Whether we want to keep additional information Use of entity sets vs. relationship sets Actions among entities are usually represented by relationships Binary versus n-ary relationship sets N-nary relationships are usually more natural for actions among entity sets Weak entity set vs. strong entity set Generalization KAUSHAL BHARDWAJ 4/22/2017

Notations KAUSHAL BHARDWAJ 4/22/2017

Notations KAUSHAL BHARDWAJ 4/22/2017

ER Practice Again Design an ER diagram for an online music store. The database will contain at least the following concepts: songs, artists, bands, albums, and genres. State your design assumptions you make to support design decisions. Be sure your assumptions are reasonable. KAUSHAL BHARDWAJ 4/22/2017

Best Practice Guide for ER Design Use of entity sets vs. attributes Use of entity sets vs. relationship sets Binary versus n-ary relationship sets Weak entity set vs. strong entity set Choose the natural one Generalization If specialized entities need to keep additional information and participate in additional relationships KAUSHAL BHARDWAJ 4/22/2017

ER for Banking Enterprise Description handhout KAUSHAL BHARDWAJ 4/22/2017

Read ER Diagrams Following are some ER diagrams grabbed from the web Read to understand/criticize KAUSHAL BHARDWAJ 4/22/2017

? ? ? ? ? ? ? ? ? KAUSHAL BHARDWAJ 4/22/2017

? ? ? ? ? KAUSHAL BHARDWAJ 4/22/2017

? KAUSHAL BHARDWAJ 4/22/2017