Entity Relationship Model

Slides:



Advertisements
Similar presentations
Chapter 6: Entity-Relationship Model
Advertisements

Chapter 6: Entity-Relationship Model (part I)
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.
Databases Revision.
1–1 The E-R Model Prof. Sin-Min Lee Department of Computer Science.
Copyright © 2007 Ramez Elmasr and Shamkant B. Navathei Week 3 Outline Overview of Database Design Process Example Database Application (COMPANY) ER Model.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
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)
Class Number – CS 304 Class Name - DBMS Instructor – Sanjay Madria Instructor – Sanjay Madria Lesson Title – ER Model.
Entity-Relationship Model
Chapter 3 Data Modeling Using the Entity-Relationship (ER) Model.
the Entity-Relationship Model
ICOM 5016 – Introduction to Database Systems Lecture 4 Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
Database System Concepts, 5th Ed. Chapter 6: Entity-Relationship Model.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan Lecture-02,03 Introduction –Data Models Lectured by, Jesmin Akhter.
Entity-Relationship Model
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model.
©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 Chapter 6: Entity-Relationship Model.
©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,
Computing & Information Sciences Kansas State University Wednesday, 24 Sep 2008CIS 560: Database System Concepts Lecture 12 of 42 Wednesday, 24 September.
Chapter 3 Data Modeling Using the Entity-Relationship (ER) Model Copyright © 2004 Pearson Education, Inc.
©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.
ITTelkom Entity Relationship Diagram (1) CS2343 Perancangan Basisdata Relasional.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan Lecture-03 Introduction –Data Models Lectured by, Jesmin Akhter.
ICOM 5016 – Introduction to Database Systems Lecture 5 Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
Data Modeling Using the Entity-Relationship (ER) Data Model (Based on Chapter 3 in Fundamentals of Database Systems by Elmasri and Navathe, Ed. 3)
Computing & Information Sciences Kansas State University Friday, 26 Sep 2008CIS 560: Database System Concepts Lecture 13 of 42 Friday, 26 September 2008.
Database and Information Retrieval System
Database Systems – ER Diagrams EXAMPLE COMPANY DATABASE Requirements of the Company (oversimplified to illustrate) The company is organized into DEPARTMENTs.
Data Modeling Using the Entity-Relationship (ER) Data Model.
Data Modeling Using the Entity- Relationship (ER) Model.
Chapter 3: Data Modeling Using the Entity-Relationship (ER) Data Model
©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 Mapping Constraints Keys.
Chapter 2: Entity-Relationship Model. 3.2 Chapter 2: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram Design Issues Weak Entity.
©Silberschatz, Korth and Sudarshan7.1Database System Concepts - 6 th Edition Chapter 7: Entity-Relationship Model.
Lecture 26 Enterprise Systems Development ( CSC447 ) COMSATS Islamabad Muhammad Usman, Assistant Professor.
Entity-Relationship Data Model
Chapter 2: Entity-Relationship Model
Contents Design Process Modeling Constraints E-R Diagram Design Issues
Data Modeling Using the Entity- Relationship (ER) Model
Entity-Relationship Model
CS4222 Principles of Database System
Data Modeling Using the Entity- Relationship (ER) Model
Database Management Systems
Entity-Relationship Model
Entity-Relationship Model
Chapter 2: Entity-Relationship Model
Chapter 7 Entity-Relationship Model
Outline of the ER Model By S.Saha
Chapter 6: Entity-Relationship Model
Chapter 2: Entity-Relationship Model
Entity-Relationship Model
Chapter 6: Entity-Relationship Model
Chapter 7: Entity-Relationship Model
Chapter 6: Entity-Relationship Model
Chapter 6: Entity-Relationship Model
Chapter 6: Entity-Relationship Model
Chapter 7: Entity-Relationship Model
Entity Relation Model Tingting Zhang.
Chapter 2: Entity-Relationship Model
Entity-Relationship Data Model
Presentation transcript:

Entity Relationship Model Basic Concepts: Database Modeling: A database can be modeled as a collection of entities and relationship among entities. Entity Relationship Model: The entity-relationship model (or ER model) is a way of graphically representing the logical relationships of entities (or objects) in order to create a database. The ER model was first proposed by Peter Pin-Shan Chen in the 1970s.

Entities: In general, an entity is an existing or real thing. It is a “thing” or “object” in the real world that is distinguishable from all other objects. These are the people, places, things, events and concepts of interest to an organization. An entity has a set of properties and the values for some set of properties may uniquely identify an entity. Entities represent collections of things. For example, an EMPLOYEE entity might represent a collection of all the employees that work for an organization. Individual members (employees) of the collection are called occurrences of the EMPLOYEE entity.

Attributes: An entity is represented by a set of attributes, that is descriptive properties possessed by all members of an entity set. Attributes are the properties that are used to describe an entity. Example an EMPLOYEE entity may have a Name, SSN, Address, Sex, BirthDate. A specific entity will have a value for each of its attributes. Example a specific employee entity may have Name='John Smith', SSN='123456789', Address='731 Fondren, Houston, TX', Sex='M', BirthDate='09-JAN-55'.

Types of Attributes: Simple Attributes: Each entity has a single atomic value for the attribute; for example SSN or Sex. 2. Composite: Composite attributes are the attributes that are composed of several components; for example Address (Apt, House, Street, City, State, ZipCode, Country) or Name (FirstName, MiddleName, LastName).

4. Single Values Attributes: 3. Multi-valued: An entity may have multiple values for that attribute. Example Color of a CAR or PreviousDegrees of a STUDENT. Denoted as {Color} or {PreviousDegrees}. 4. Single Values Attributes: Attributes having single value for a particular entity are called as single valued attributes. Example, Age is a single value for a particular entity Person.

5. Stored Attributes: 6. Derived Attributes: Domain: An attribute whose value is actually stored in a database is called as a stored attribute. 6. Derived Attributes: In some cases two or more attribute values are related. Example the age and Birthdate attributes of a person. For a particular person entity, the value of Age can be determined from the current date and the value of that person’s Birthdate. The Age attribute is hence caleed as derived attribute. Domain: Domain is the set of permitted values for each attribute.

Entity Sets customer and loan Customer Customer Customer customer Loan Amount ID name street City number

Relationship: Hayes depositor A102 A relationship relates two or more distinct entities with a specific meaning. It is an association among several entities. Example: Hayes depositor A102 Customer entity relationship set Account entity

Relationship Set: Example: A relationship set is a mathematical relation among n >= 2 entities, each taken from entity sets. where (e1, e2, …, en) is a relationship Example: (Hayes, A102) Є depositor {(e1, e2, … en) | e1 Є E1, e2 Є E2, …, en Є En}

Relationship Set borrower:

An attribute can also be property of a relationship set. For instance, the depositor relationship set between entity sets customer and account may have the attribute access_date.

Degree of a Relationship Set: Refers to number of entity sets that participate in a relationship set. Relationship sets that involve two entity sets are binary (or degree two). Generally, most relationship sets in a database system are binary. Relationship sets may involve more than two entity sets. Example: Suppose employees of a bank may have jobs (responsibilities) at multiple branches, with different jobs at different branches. Then there is a ternary relationship set between entity sets employee, job, and branch.

Mapping Cardinalities: The cardinality ratio for a binary relationship specifies the number of relationship instances that an entity can participate in. Note: Some elements in A and B may not be mapped to any elements in the other set One to One One to Many

Many to One Many to Many

Keys: Super Key: A super key of an entity set is a set of one or more attributes whose values uniquely determine each entity. Candidate Key: A candidate key of an entity set is a minimal super key E.g. Customer_id is candidate key of customer and account_number is candidate key of account. Primary Key: Although several candidate keys may exist, one of the candidate keys is selected to be the primary key. Primary key is an attribute which uniquely identifies each entity in an entity set.

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) is the super key of depositor. NOTE: This means a pair of entity sets can have at most one relationship in a particular relationship set.

E-R Diagram Notations:

ER Diagram With Composite, Multivalued, and Derived Attributes:

Relationship Sets with Attributes:

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 ER diagrams by labeling the lines that connect diamonds to rectangles. Role labels are optional, and are used to clarify semantics of the relationship.

Cardinality Constraints: Cardinality constraints are expressed by drawing either a directed line ( )signifying “one,” or an undirected line (—), signifying “many,” between the relationship set and the entity set. One to one relationship: A customer is associated with at most one loan via the relationship borrower. A loan is associated with at most one customer via borrower.

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. 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 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.

Relationship Set: Total participation is indicated by double line: every entity in the entity set participates in at least one relationship in the relationship set. E.g. 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. Example: participation of customer in borrower is partial.

ER Diagram with a Ternary Relationship:

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 is 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.

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).