SlideShare a Scribd company logo
1 of 61
.
Ms.V
. Saranya
AP/CSE
SrividyacollegeofEngg&T
ech, Virudhunagar.
diagram
Objectives
• To illustrate how relationships
entities are defined and refined.
between
• 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-to-
many, 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.
Employees
ssn
name
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.
Person, place, object, event or
concept about which data is to
be maintained
named property or
characteristic of an
entity
Association between
the instances of one
or more entity types
EntityName Verb Phrase AttributeName
Example
RELATIONSHIP
• Relationship: Association among two or
more entities. e.g., rose works in Pharmacy
department.
• Relationship Set:
relationships.
Collection of similar
• 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.
Author Book
Relationshipname:
writes
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
Name IdNum DeptID Email
Ali 105 LG ali@a.com
Mary
John
Lim
106
107
108
IT
ENG
IT
mary@a.com
john@a.com
lim@a.com
Instance of Lecturer.
Referential attribute: Ties the lecturer entity to another
entity that is department.
• Make Reference to another instance in another table
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
• Key and key attributes:
– 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
(ER Model is used at this
• Conceptual design:
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
• Cardinality : minimum and maximum number of
instances of Entity B that can (or must be) associated
with each instance of entity A.
Connectivity
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
associated with several
customers via borrower, a
(including
customer
• In a many-to-one relationship a loan is
0)
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
• Crow’s Foot
many
One or many
One
1
M
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
This CANNOT be implemented as shown next…..
Bowser
Smithson
Accounting 1 (ACCT-211)
Intro to Microcomputing (CIS-220)
Intro to Statistics (QM-261)
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 higher-
level 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 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  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

More Related Content

Similar to entityrelationshipmodel.pptx

Similar to entityrelationshipmodel.pptx (20)

DBMS Class 3
DBMS Class 3DBMS Class 3
DBMS Class 3
 
Database design
Database designDatabase design
Database design
 
ERD(2).ppt
ERD(2).pptERD(2).ppt
ERD(2).ppt
 
ER MODEL.pptx
ER MODEL.pptxER MODEL.pptx
ER MODEL.pptx
 
entity-relationship-diagram-chen-&-crow -model.ppt
entity-relationship-diagram-chen-&-crow -model.pptentity-relationship-diagram-chen-&-crow -model.ppt
entity-relationship-diagram-chen-&-crow -model.ppt
 
lecture2.pdf
lecture2.pdflecture2.pdf
lecture2.pdf
 
10287 lecture5(2)
10287 lecture5(2)10287 lecture5(2)
10287 lecture5(2)
 
ER Digramms by Harshal wagh
ER Digramms by Harshal waghER Digramms by Harshal wagh
ER Digramms by Harshal wagh
 
er-models.pptx
er-models.pptxer-models.pptx
er-models.pptx
 
Conceptual Modeling of Data
Conceptual Modeling of DataConceptual Modeling of Data
Conceptual Modeling of Data
 
RDBMS ERD
RDBMS ERDRDBMS ERD
RDBMS ERD
 
Chapter 2. Concepctual design -.pptx
Chapter 2. Concepctual design -.pptxChapter 2. Concepctual design -.pptx
Chapter 2. Concepctual design -.pptx
 
database.pptx
database.pptxdatabase.pptx
database.pptx
 
Er model
Er modelEr model
Er model
 
ER Modeling and Introduction to RDBMS
ER Modeling and Introduction to RDBMSER Modeling and Introduction to RDBMS
ER Modeling and Introduction to RDBMS
 
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.
 
2 er
2 er2 er
2 er
 
ER-Model-ER Diagram
ER-Model-ER DiagramER-Model-ER Diagram
ER-Model-ER Diagram
 
Cardinality and participation constraints
Cardinality and participation constraintsCardinality and participation constraints
Cardinality and participation constraints
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship Model
 

More from ThangamaniR3

Datalink_func.pptx
Datalink_func.pptxDatalink_func.pptx
Datalink_func.pptxThangamaniR3
 
unit 2_switchingtechniques.ppt
unit 2_switchingtechniques.pptunit 2_switchingtechniques.ppt
unit 2_switchingtechniques.pptThangamaniR3
 
relational model.pptx
relational model.pptxrelational model.pptx
relational model.pptxThangamaniR3
 
ermodelppt-181229121745.pptx
ermodelppt-181229121745.pptxermodelppt-181229121745.pptx
ermodelppt-181229121745.pptxThangamaniR3
 
4-therelationaldatamodelandrelationaldatabaseconstraints-140128022150-phpapp0...
4-therelationaldatamodelandrelationaldatabaseconstraints-140128022150-phpapp0...4-therelationaldatamodelandrelationaldatabaseconstraints-140128022150-phpapp0...
4-therelationaldatamodelandrelationaldatabaseconstraints-140128022150-phpapp0...ThangamaniR3
 
474-22-DatagramForwarding.pptx
474-22-DatagramForwarding.pptx474-22-DatagramForwarding.pptx
474-22-DatagramForwarding.pptxThangamaniR3
 

More from ThangamaniR3 (13)

dl_frames.ppt
dl_frames.pptdl_frames.ppt
dl_frames.ppt
 
Datalink_func.pptx
Datalink_func.pptxDatalink_func.pptx
Datalink_func.pptx
 
datalink.ppt
datalink.pptdatalink.ppt
datalink.ppt
 
unit 2.pptx
unit 2.pptxunit 2.pptx
unit 2.pptx
 
unit 2_switchingtechniques.ppt
unit 2_switchingtechniques.pptunit 2_switchingtechniques.ppt
unit 2_switchingtechniques.ppt
 
relational model.pptx
relational model.pptxrelational model.pptx
relational model.pptx
 
csmacd.pptx
csmacd.pptxcsmacd.pptx
csmacd.pptx
 
nic.pptx
nic.pptxnic.pptx
nic.pptx
 
ermodelppt-181229121745.pptx
ermodelppt-181229121745.pptxermodelppt-181229121745.pptx
ermodelppt-181229121745.pptx
 
4-therelationaldatamodelandrelationaldatabaseconstraints-140128022150-phpapp0...
4-therelationaldatamodelandrelationaldatabaseconstraints-140128022150-phpapp0...4-therelationaldatamodelandrelationaldatabaseconstraints-140128022150-phpapp0...
4-therelationaldatamodelandrelationaldatabaseconstraints-140128022150-phpapp0...
 
474-22-DatagramForwarding.pptx
474-22-DatagramForwarding.pptx474-22-DatagramForwarding.pptx
474-22-DatagramForwarding.pptx
 
section 4.3.pptx
section 4.3.pptxsection 4.3.pptx
section 4.3.pptx
 
dbase aplns.pptx
dbase aplns.pptxdbase aplns.pptx
dbase aplns.pptx
 

Recently uploaded

Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 

Recently uploaded (20)

OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 

entityrelationshipmodel.pptx

  • 2. Objectives • To illustrate how relationships entities are defined and refined. between • To know how relationships are incorporated into the database design process. • To describe how ERD components affect database design and implementation
  • 3. Topics • Design Process • Modeling • Constraints • E-R Diagram • Design Issues • Weak Entity Sets • Extended E-R Features
  • 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-to- many, 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. Employees ssn name 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. Person, place, object, event or concept about which data is to be maintained named property or characteristic of an entity Association between the instances of one or more entity types EntityName Verb Phrase AttributeName Example
  • 15. RELATIONSHIP • Relationship: Association among two or more entities. e.g., rose works in Pharmacy department. • Relationship Set: relationships. Collection of similar • 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. Author Book Relationshipname: writes 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 Name IdNum DeptID Email Ali 105 LG ali@a.com Mary John Lim 106 107 108 IT ENG IT mary@a.com john@a.com lim@a.com Instance of Lecturer. Referential attribute: Ties the lecturer entity to another entity that is department. • Make Reference to another instance in another table
  • 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 • Key and key attributes: – 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 (ER Model is used at this • Conceptual design: 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 • Cardinality : minimum and maximum number of instances of Entity B that can (or must be) associated with each instance of entity A. Connectivity
  • 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 associated with several customers via borrower, a (including customer • In a many-to-one relationship a loan is 0) 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 • Crow’s Foot many One or many One 1 M 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 This CANNOT be implemented as shown next….. Bowser Smithson Accounting 1 (ACCT-211) Intro to Microcomputing (CIS-220) Intro to Statistics (QM-261)
  • 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 higher- level 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 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  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