SlideShare une entreprise Scribd logo
1  sur  61
diagram
.

Ms.V. Saranya
AP/CSE
Sri vidya college of Engg & Tech, Virudhunagar.
Objectives
• To illustrate how relationships between
entities are defined and refined.
• To know how relationships are incorporated

into the database design process.
• To describe how ERD components affect

database design and implementation
Topics
•
•
•
•
•
•
•

Design Process
Modeling
Constraints
E-R Diagram
Design Issues
Weak Entity Sets
Extended E-R Features
DATA
unorganized
form

ex: student’s
score
Information
processed, structured and
organized data
ex: class average which can be
calculated from data.
TABLE
A table is a collection (rows) of data
on a single related topic.
Difference between table and
database
Table

Database

A table is an object inside a
database

A database has tables of data,

a table is a collection (rows) of data
on a single related topic.

A database can have 10 or
thousands of tables

Ex: employee table
Contains only employees detail. But
it not contains inventory detail.

But DB is a collection of Employee
table as well as inventory table.
Sample Table
Sample Database

DB is a
collection
related
tables
Why we need ER diagram
 giving you image of how the tables
should connect
 what fields are going to be on each
table
 the tables connection, if many-tomany, one-to-many.
“ER diagrams are easy for non-technical
people to understand, and thus are
typically used by database designers
before the schema ever exists”
Entity
• An entity is something that exists by itself.
• Entity: Real-world object distinguishable from
other objects. An entity is described using a
set of attributes.

ssn

name

Employees

email
Examples of entities
– Person: EMPLOYEE, STUDENT, PATIENT
– Place: STORE, WAREHOUSE
– Object: MACHINE, PRODUCT, CAR

– Event: SALE,REGISTRATION, RENEWAL
– Concept: ACCOUNT, COURSE
Entity set
• Entity Set: A collection of similar entities.
E.g., all employees.
–
–
–

All entities in an entity set have the same set of
attributes.
Each entity set has a key.
Each attribute has a domain.
Example
Association between
the instances of one
or more entity types

EntityName

Person, place, object, event or
concept about which data is to
be maintained

Verb Phrase

AttributeName

named property or
characteristic of an
entity
RELATIONSHIP
• Relationship: Association among two or
more entities. e.g., rose works in Pharmacy
department.
• Relationship Set:
Collection of similar
relationships.
• Same entity set could participate in different
relationship sets, or in different “roles” in same set.
Relationship Example
 Associations between instances of one or more entity types that is of interest
 Given a name that describes its function.

• relationship name is an active or a passive verb.

Relationship name:
writes
Author

Book

An author writes one or more books
A book can be written by one or more authors.
Degree of Relationships
• Degree: number of entity types that participate in a relationship
• Three cases
– Unary: between two instances of one entity type
– Binary: between the instances of two entity types
– Ternary: among the instances of three entity types
Attributes
• Example of entity types and associated attributes:
STUDENT: Student_ID, Student_Name, Home_Address, Phone_Number,
Major
Attribute types
– Simple and composite attributes.
– Single-valued and multi-valued attributes
• Example: multivalued attribute: phone_numbers

– Derived attributes
• Can be computed from other attributes
• Example: age, given date_of_birth
A composite attribute
Referential Attributes
•

Make Reference to another instance in another table
Referential attribute: Ties the lecturer entity to another
entity that is department.

Name
Ali

105

LG

ali@a.com

Mary

106

IT

mary@a.com

John

107

ENG

john@a.com

Lim
Instance of Lecturer.

IdNum

DeptID

Email

108

IT

lim@a.com
Mapping Cardinality Constraints
• Express the number of entities to which another
entity can be associated via a relationship set.
• Most useful in describing binary relationship sets.
• 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
Mapping Cardinalities

One to one

One to many

Note: Some elements in A and B may not be mapped to any
elements in the other set
Mapping Cardinalities

Many to one

Many to many

Note: Some elements in A and B may not be mapped to any
elements in the other set
• Key and key attributes:

KEY

– Key: a unique value for an entity
– Key attributes: a group of one or more attributes that uniquely
identify an entity in the entity set

• Super key, candidate key, and primary key
–
–

Super key: a set of attributes that allows to identify and entity
uniquely in the entity set
Candidate key: minimal super key
•

–

There can be many candidate keys

Primary key: a candidate key chosen by the designer
•

Denoted by underlining in ER attributes.
Key Constraints
• Consider Works_In: An employee can work in many
departments; a dept can have many employees.
• In contrast, each dept has at most one manager,
according to the key constraint on Manages.
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.
• In a relational database, a Weak Entity is an entity that
cannot be uniquely identified by its attributes alone;
therefore, it must use a foreign key in conjunction with
its attributes to create a primary key. The foreign key is
typically a primary key of an entity it is related to.
Conceptual design
• Conceptual design: (ER Model is used at this
stage.)
• Process of describing the data, relationships between
the data, and the constraints on the data.
Entity-Relationship (ER) Diagram
• ER Modeling is a “top-down” approach to database
design.
• Entity Relationship (ER) Diagram
– A detailed, “logical representation” of the entities,
associations and data elements for an organization or
business

Notation uses three main constructs
– Data entities
– Relationships
– Attributes
E-R Diagrams

 Rectangles represent entity sets.
 Diamonds represent relationship sets.
 Lines link attributes to entity sets and entity sets to relationship sets.
 Ellipses represent attributes


Double ellipses represent multivalued attributes.



Dashed ellipses denote derived attributes.

 Underline indicates primary key attributes (will study later)
E-R 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 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
Cardinality and Connectivity
• Relationships can be classified as either
• one – to – one
• one – to – many
• many – to –many

Connectivity

• Cardinality : minimum and maximum number of
instances of Entity B that can (or must be) associated
with each instance of entity A.
Cardinality Constraints
• We express cardinality constraints 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
Connectivity

• Chen Model
– 1 to represent one.
– M to represent many

1

M

• Crow’s Foot
One
many

One or many

Mandatory one , means (1,1)
Binary Relationships
•

1:M relationship
–
Relational modeling ideal
–
Should be the norm in any relational database design

The 1: M relationship between PAINTER and PAINTING
Binary Relationships
•

1:1 relationship
– Should be rare in any relational database design
– A single entity instance in one entity class is
related to a single entity instance in another
entity class
– Could indicate that two entities actually belong
in the same table
The 1:1 Relationship Between PROFESSOR and DEPARTMENT
Binary Relationships
•

M:N relationships
–

Must be avoided because they lead to data redundancies.

–

Can be implemented by breaking it up to produce a set of 1:M
relationships

–

Can avoid problems inherent to M:N relationship by creating a

composite entity or bridge entity
•

This will be used to link the tables that were originally
related in a M:N relationship

•

The composite entity structure includes-as foreign keys-at
least the primary keys of the tables that are to be linked.
The M:N Relationship Between STUDENT and CLASS

Bowser

Smithson

Accounting 1 (ACCT-211)
Intro to Microcomputing (CIS-220)
Intro to Statistics (QM-261)

This CANNOT be implemented as shown next…..
Changing the M:N relationship to TWO 1:M relationships
Extended E-R
• Specialization
• Generalization
• Aggregation
Specialization
• Top-down design process: we designate sub
groupings within an entity set that are
distinctive from other entities in the set.
• These sub groupings become lower-level entity
sets that have attributes or participate in
relationships that do not apply to the higherlevel entity set.
• Depicted by a “triangle component labeled ISA”
• 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.
Specialization Example
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.
Specialization and Generalization
(Cont.)

• Can have multiple specializations of an entity
set based on different features.
• E.g.
permanent_employee
vs.
temporary_employee, in addition to officer vs.
secretary vs. teller
• Each particular employee would be
– a member of one of permanent_employee or
temporary_employee,
– and also a member of one of officer, secretary, or
teller

• The ISA relationship also referred to as
“superclass – subclass” relationship
Design Constraints on a
Specialization/Generalization
• Constraint on which entities can be members of a
given lower-level entity set.
– Condition-defined : evaluated by an explicit condition or
predicate.
– User-defined : database user assigns

• 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
Design Constraints on a
Specialization/Generalization (Contd.)
• Completeness constraint
– 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
Aggregation
 Consider the ternary relationship works-on, which we saw earlier
 Suppose we want to record managers for tasks performed by an

employee at a branch
Aggregation (Cont.)
• Relationship sets works_on and manages represent
overlapping information
– Every manages relationship corresponds to a works_on
relationship
– However, some works_on relationships may not correspond to
any manages relationships
• So we can’t discard the works_on relationship

• Eliminate this redundancy via aggregation
– Treat relationship as an abstract entity
– Allows relationships between relationships
– Abstraction of relationship into new entity

• Without introducing redundancy, the following diagram
represents:
– An employee works on a particular job at a particular branch
– An employee, branch, job combination may have an associated
manager
Aggregation (Cont.)
• Relationship sets works-on and
represent overlapping information

manages

– Every manages relationship corresponds to a workson relationship
– However, some works-on relationships may not
correspond to any manages relationships  we
can’t discard the works-on relationship

• Redundancy problem  aggregation
E-R Diagram With Aggregation
Summary of Symbols Used in E-R
Notation
Summary of Symbols (Cont.)
Alternative E-R Notations

Contenu connexe

Tendances

Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship DiagramShakila Mahjabin
 
Enhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) ModelingEnhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) Modelingsontumax
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity ConstraintsMegha yadav
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLEVraj Patel
 
Integrity constraints in dbms
Integrity constraints in dbmsIntegrity constraints in dbms
Integrity constraints in dbmsVignesh Saravanan
 
Unit 1: Introduction to DBMS Unit 1 Complete
Unit 1: Introduction to DBMS Unit 1 CompleteUnit 1: Introduction to DBMS Unit 1 Complete
Unit 1: Introduction to DBMS Unit 1 CompleteRaj vardhan
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model IntroductionNishant Munjal
 
Database Management System
Database Management SystemDatabase Management System
Database Management SystemNishant Munjal
 
Types of Database Models
Types of Database ModelsTypes of Database Models
Types of Database ModelsMurassa Gillani
 
Chapter 6 relational data model and relational
Chapter  6  relational data model and relationalChapter  6  relational data model and relational
Chapter 6 relational data model and relationalJafar Nesargi
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational modelChirag vasava
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraintsmadhav bansal
 
ER model to Relational model mapping
ER model to Relational model mappingER model to Relational model mapping
ER model to Relational model mappingShubham Saini
 
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...Raj vardhan
 
Database : Relational Data Model
Database : Relational Data ModelDatabase : Relational Data Model
Database : Relational Data ModelSmriti Jain
 
Er model ppt
Er model pptEr model ppt
Er model pptPihu Goel
 
1.4 data independence
1.4 data independence1.4 data independence
1.4 data independenceBHARATH KUMAR
 

Tendances (20)

Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
 
Er diagram
Er diagramEr diagram
Er diagram
 
Enhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) ModelingEnhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) Modeling
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
 
Integrity constraints in dbms
Integrity constraints in dbmsIntegrity constraints in dbms
Integrity constraints in dbms
 
Unit 1: Introduction to DBMS Unit 1 Complete
Unit 1: Introduction to DBMS Unit 1 CompleteUnit 1: Introduction to DBMS Unit 1 Complete
Unit 1: Introduction to DBMS Unit 1 Complete
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
 
Database Management System
Database Management SystemDatabase Management System
Database Management System
 
Types of Database Models
Types of Database ModelsTypes of Database Models
Types of Database Models
 
Schema
SchemaSchema
Schema
 
Chapter 6 relational data model and relational
Chapter  6  relational data model and relationalChapter  6  relational data model and relational
Chapter 6 relational data model and relational
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 
DBMS PPT
DBMS PPTDBMS PPT
DBMS PPT
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
 
ER model to Relational model mapping
ER model to Relational model mappingER model to Relational model mapping
ER model to Relational model mapping
 
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
 
Database : Relational Data Model
Database : Relational Data ModelDatabase : Relational Data Model
Database : Relational Data Model
 
Er model ppt
Er model pptEr model ppt
Er model ppt
 
1.4 data independence
1.4 data independence1.4 data independence
1.4 data independence
 

Similaire à Entity Relationship Model

Similaire à Entity Relationship Model (20)

Revision ch 3
Revision ch 3Revision ch 3
Revision ch 3
 
Entityrelationshipmodel
EntityrelationshipmodelEntityrelationshipmodel
Entityrelationshipmodel
 
entityrelationshipmodel.pptx
entityrelationshipmodel.pptxentityrelationshipmodel.pptx
entityrelationshipmodel.pptx
 
DBMS Class 3
DBMS Class 3DBMS Class 3
DBMS Class 3
 
Day 1 SQL.pptx
Day 1 SQL.pptxDay 1 SQL.pptx
Day 1 SQL.pptx
 
SQL.pptx
SQL.pptxSQL.pptx
SQL.pptx
 
10287 lecture5(2)
10287 lecture5(2)10287 lecture5(2)
10287 lecture5(2)
 
Data Models.pptx
Data Models.pptxData Models.pptx
Data Models.pptx
 
18306_lec-2 (1).ppt
18306_lec-2 (1).ppt18306_lec-2 (1).ppt
18306_lec-2 (1).ppt
 
DATA MODEL PRESENTATION UNIT I-BCA I.pptx
DATA MODEL PRESENTATION UNIT I-BCA I.pptxDATA MODEL PRESENTATION UNIT I-BCA I.pptx
DATA MODEL PRESENTATION UNIT I-BCA I.pptx
 
er-models.pptx
er-models.pptxer-models.pptx
er-models.pptx
 
Database design
Database designDatabase design
Database design
 
lecture2.pdf
lecture2.pdflecture2.pdf
lecture2.pdf
 
ERD(2).ppt
ERD(2).pptERD(2).ppt
ERD(2).ppt
 
Database part3-
Database part3-Database part3-
Database part3-
 
ER MODEL.pptx
ER MODEL.pptxER MODEL.pptx
ER MODEL.pptx
 
ER Digramms by Harshal wagh
ER Digramms by Harshal waghER Digramms by Harshal wagh
ER Digramms by Harshal wagh
 
Cn presentation on the topic called as re modelling
Cn presentation on the topic called as re modellingCn presentation on the topic called as re modelling
Cn presentation on the topic called as re modelling
 
Presentation of saad on e-r diagram.
Presentation of saad on e-r diagram.Presentation of saad on e-r diagram.
Presentation of saad on e-r diagram.
 
Entity relationship diagram (erd)
Entity relationship diagram (erd)Entity relationship diagram (erd)
Entity relationship diagram (erd)
 

Plus de Slideshare

Crystal report generation in visual studio 2010
Crystal report generation in visual studio 2010Crystal report generation in visual studio 2010
Crystal report generation in visual studio 2010Slideshare
 
Report generation
Report generationReport generation
Report generationSlideshare
 
Security in Relational model
Security in Relational modelSecurity in Relational model
Security in Relational modelSlideshare
 
Major issues in data mining
Major issues in data miningMajor issues in data mining
Major issues in data miningSlideshare
 
Data preprocessing
Data preprocessingData preprocessing
Data preprocessingSlideshare
 
What is in you
What is in youWhat is in you
What is in youSlideshare
 
Propositional logic & inference
Propositional logic & inferencePropositional logic & inference
Propositional logic & inferenceSlideshare
 
Logical reasoning 21.1.13
Logical reasoning 21.1.13Logical reasoning 21.1.13
Logical reasoning 21.1.13Slideshare
 
Statistical learning
Statistical learningStatistical learning
Statistical learningSlideshare
 
Resolution(decision)
Resolution(decision)Resolution(decision)
Resolution(decision)Slideshare
 
Reinforcement learning 7313
Reinforcement learning 7313Reinforcement learning 7313
Reinforcement learning 7313Slideshare
 
Neural networks
Neural networksNeural networks
Neural networksSlideshare
 
Instance based learning
Instance based learningInstance based learning
Instance based learningSlideshare
 
Statistical learning
Statistical learningStatistical learning
Statistical learningSlideshare
 
Neural networks
Neural networksNeural networks
Neural networksSlideshare
 
Logical reasoning
Logical reasoning Logical reasoning
Logical reasoning Slideshare
 
Instance based learning
Instance based learningInstance based learning
Instance based learningSlideshare
 

Plus de Slideshare (20)

Crystal report generation in visual studio 2010
Crystal report generation in visual studio 2010Crystal report generation in visual studio 2010
Crystal report generation in visual studio 2010
 
Report generation
Report generationReport generation
Report generation
 
Trigger
TriggerTrigger
Trigger
 
Security in Relational model
Security in Relational modelSecurity in Relational model
Security in Relational model
 
OLAP
OLAPOLAP
OLAP
 
Major issues in data mining
Major issues in data miningMajor issues in data mining
Major issues in data mining
 
Data preprocessing
Data preprocessingData preprocessing
Data preprocessing
 
What is in you
What is in youWhat is in you
What is in you
 
Propositional logic & inference
Propositional logic & inferencePropositional logic & inference
Propositional logic & inference
 
Logical reasoning 21.1.13
Logical reasoning 21.1.13Logical reasoning 21.1.13
Logical reasoning 21.1.13
 
Logic agent
Logic agentLogic agent
Logic agent
 
Statistical learning
Statistical learningStatistical learning
Statistical learning
 
Resolution(decision)
Resolution(decision)Resolution(decision)
Resolution(decision)
 
Reinforcement learning 7313
Reinforcement learning 7313Reinforcement learning 7313
Reinforcement learning 7313
 
Neural networks
Neural networksNeural networks
Neural networks
 
Instance based learning
Instance based learningInstance based learning
Instance based learning
 
Statistical learning
Statistical learningStatistical learning
Statistical learning
 
Neural networks
Neural networksNeural networks
Neural networks
 
Logical reasoning
Logical reasoning Logical reasoning
Logical reasoning
 
Instance based learning
Instance based learningInstance based learning
Instance based learning
 

Dernier

Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxleah joy valeriano
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 

Dernier (20)

Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 

Entity Relationship Model

  • 1. diagram . Ms.V. Saranya AP/CSE Sri vidya college of Engg & Tech, Virudhunagar.
  • 2. Objectives • To illustrate how relationships between entities are defined and refined. • To know how relationships are incorporated into the database design process. • To describe how ERD components affect database design and implementation
  • 5. Information processed, structured and organized data ex: class average which can be calculated from data.
  • 6. TABLE A table is a collection (rows) of data on a single related topic.
  • 7. Difference between table and database Table Database A table is an object inside a database A database has tables of data, a table is a collection (rows) of data on a single related topic. A database can have 10 or thousands of tables Ex: employee table Contains only employees detail. But it not contains inventory detail. But DB is a collection of Employee table as well as inventory table.
  • 9. Sample Database DB is a collection related tables
  • 10. Why we need ER diagram  giving you image of how the tables should connect  what fields are going to be on each table  the tables connection, if many-tomany, one-to-many. “ER diagrams are easy for non-technical people to understand, and thus are typically used by database designers before the schema ever exists”
  • 11. Entity • An entity is something that exists by itself. • Entity: Real-world object distinguishable from other objects. An entity is described using a set of attributes. ssn name Employees email
  • 12. Examples of entities – Person: EMPLOYEE, STUDENT, PATIENT – Place: STORE, WAREHOUSE – Object: MACHINE, PRODUCT, CAR – Event: SALE,REGISTRATION, RENEWAL – Concept: ACCOUNT, COURSE
  • 13. Entity set • Entity Set: A collection of similar entities. E.g., all employees. – – – All entities in an entity set have the same set of attributes. Each entity set has a key. Each attribute has a domain.
  • 14. Example Association between the instances of one or more entity types EntityName Person, place, object, event or concept about which data is to be maintained Verb Phrase AttributeName named property or characteristic of an entity
  • 15. RELATIONSHIP • Relationship: Association among two or more entities. e.g., rose works in Pharmacy department. • Relationship Set: Collection of similar relationships. • Same entity set could participate in different relationship sets, or in different “roles” in same set.
  • 16. Relationship Example  Associations between instances of one or more entity types that is of interest  Given a name that describes its function. • relationship name is an active or a passive verb. Relationship name: writes Author Book An author writes one or more books A book can be written by one or more authors.
  • 17. Degree of Relationships • Degree: number of entity types that participate in a relationship • Three cases – Unary: between two instances of one entity type – Binary: between the instances of two entity types – Ternary: among the instances of three entity types
  • 18. Attributes • Example of entity types and associated attributes: STUDENT: Student_ID, Student_Name, Home_Address, Phone_Number, Major
  • 19. Attribute types – Simple and composite attributes. – Single-valued and multi-valued attributes • Example: multivalued attribute: phone_numbers – Derived attributes • Can be computed from other attributes • Example: age, given date_of_birth
  • 21. Referential Attributes • Make Reference to another instance in another table Referential attribute: Ties the lecturer entity to another entity that is department. Name Ali 105 LG ali@a.com Mary 106 IT mary@a.com John 107 ENG john@a.com Lim Instance of Lecturer. IdNum DeptID Email 108 IT lim@a.com
  • 22. Mapping Cardinality Constraints • Express the number of entities to which another entity can be associated via a relationship set. • Most useful in describing binary relationship sets. • 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
  • 23. Mapping Cardinalities One to one One to many Note: Some elements in A and B may not be mapped to any elements in the other set
  • 24. Mapping Cardinalities Many to one Many to many Note: Some elements in A and B may not be mapped to any elements in the other set
  • 25. • Key and key attributes: KEY – Key: a unique value for an entity – Key attributes: a group of one or more attributes that uniquely identify an entity in the entity set • Super key, candidate key, and primary key – – Super key: a set of attributes that allows to identify and entity uniquely in the entity set Candidate key: minimal super key • – There can be many candidate keys Primary key: a candidate key chosen by the designer • Denoted by underlining in ER attributes.
  • 26. Key Constraints • Consider Works_In: An employee can work in many departments; a dept can have many employees. • In contrast, each dept has at most one manager, according to the key constraint on Manages.
  • 27. 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.
  • 28. • In a relational database, a Weak Entity is an entity that cannot be uniquely identified by its attributes alone; therefore, it must use a foreign key in conjunction with its attributes to create a primary key. The foreign key is typically a primary key of an entity it is related to.
  • 29.
  • 30. Conceptual design • Conceptual design: (ER Model is used at this stage.) • Process of describing the data, relationships between the data, and the constraints on the data.
  • 31. Entity-Relationship (ER) Diagram • ER Modeling is a “top-down” approach to database design. • Entity Relationship (ER) Diagram – A detailed, “logical representation” of the entities, associations and data elements for an organization or business Notation uses three main constructs – Data entities – Relationships – Attributes
  • 32. E-R Diagrams  Rectangles represent entity sets.  Diamonds represent relationship sets.  Lines link attributes to entity sets and entity sets to relationship sets.  Ellipses represent attributes  Double ellipses represent multivalued attributes.  Dashed ellipses denote derived attributes.  Underline indicates primary key attributes (will study later)
  • 33. E-R Diagram With Composite, Multivalued, and Derived Attributes
  • 35. 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
  • 36. Cardinality and Connectivity • Relationships can be classified as either • one – to – one • one – to – many • many – to –many Connectivity • Cardinality : minimum and maximum number of instances of Entity B that can (or must be) associated with each instance of entity A.
  • 37. Cardinality Constraints • We express cardinality constraints 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
  • 38. 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
  • 39. 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
  • 40. 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
  • 41. Connectivity • Chen Model – 1 to represent one. – M to represent many 1 M • Crow’s Foot One many One or many Mandatory one , means (1,1)
  • 42. Binary Relationships • 1:M relationship – Relational modeling ideal – Should be the norm in any relational database design The 1: M relationship between PAINTER and PAINTING
  • 43. Binary Relationships • 1:1 relationship – Should be rare in any relational database design – A single entity instance in one entity class is related to a single entity instance in another entity class – Could indicate that two entities actually belong in the same table
  • 44. The 1:1 Relationship Between PROFESSOR and DEPARTMENT
  • 45. Binary Relationships • M:N relationships – Must be avoided because they lead to data redundancies. – Can be implemented by breaking it up to produce a set of 1:M relationships – Can avoid problems inherent to M:N relationship by creating a composite entity or bridge entity • This will be used to link the tables that were originally related in a M:N relationship • The composite entity structure includes-as foreign keys-at least the primary keys of the tables that are to be linked.
  • 46. The M:N Relationship Between STUDENT and CLASS Bowser Smithson Accounting 1 (ACCT-211) Intro to Microcomputing (CIS-220) Intro to Statistics (QM-261) This CANNOT be implemented as shown next…..
  • 47. Changing the M:N relationship to TWO 1:M relationships
  • 48. Extended E-R • Specialization • Generalization • Aggregation
  • 49. Specialization • Top-down design process: we designate sub groupings within an entity set that are distinctive from other entities in the set. • These sub groupings become lower-level entity sets that have attributes or participate in relationships that do not apply to the higherlevel entity set. • Depicted by a “triangle component labeled ISA” • 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.
  • 51. 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.
  • 52. Specialization and Generalization (Cont.) • Can have multiple specializations of an entity set based on different features. • E.g. permanent_employee vs. temporary_employee, in addition to officer vs. secretary vs. teller • Each particular employee would be – a member of one of permanent_employee or temporary_employee, – and also a member of one of officer, secretary, or teller • The ISA relationship also referred to as “superclass – subclass” relationship
  • 53. Design Constraints on a Specialization/Generalization • Constraint on which entities can be members of a given lower-level entity set. – Condition-defined : evaluated by an explicit condition or predicate. – User-defined : database user assigns • 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
  • 54. Design Constraints on a Specialization/Generalization (Contd.) • Completeness constraint – 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
  • 55. Aggregation  Consider the ternary relationship works-on, which we saw earlier  Suppose we want to record managers for tasks performed by an employee at a branch
  • 56. Aggregation (Cont.) • Relationship sets works_on and manages represent overlapping information – Every manages relationship corresponds to a works_on relationship – However, some works_on relationships may not correspond to any manages relationships • So we can’t discard the works_on relationship • Eliminate this redundancy via aggregation – Treat relationship as an abstract entity – Allows relationships between relationships – Abstraction of relationship into new entity • Without introducing redundancy, the following diagram represents: – An employee works on a particular job at a particular branch – An employee, branch, job combination may have an associated manager
  • 57. Aggregation (Cont.) • Relationship sets works-on and represent overlapping information manages – Every manages relationship corresponds to a workson relationship – However, some works-on relationships may not correspond to any manages relationships  we can’t discard the works-on relationship • Redundancy problem  aggregation
  • 58. E-R Diagram With Aggregation
  • 59. Summary of Symbols Used in E-R Notation