SlideShare ist ein Scribd-Unternehmen logo
1 von 35
ER MODEL
ER Model
• The entity-relationship model (or ER model) is a high-level conceptual
data model representing the logical relationships of entities (or
objects) in order to create a database and is widely used to develop
an initial database design.
• ER model was first proposed by Peter Pin-Shan Chen of
Massachusetts Institute of Technology (MIT) in the 1970s.
• The diagrammatic notation used in the ER model for representing
entities with properties and their relationships is known as ER
diagrams.
2
Entity and Entity Sets
• Entities
• An entity is a “thing” or “object” in the real world that is
distinguishable from all other objects.
For example, each person in an enterprise is an entity.
• Entity Sets
• An entity set is a set of entities of the same type that share the
same properties, or attributes.
• Set of all persons who are customers at a given bank can
be defined as the entity set customer.
• Other examples: students, courses, employees, departments,
flights, patients.
3
Entity and Entity Sets
Entity Sets Customer and Loan
4
Attributes
• Attributes are descriptive properties possessed by each
member of an entity set.
• Possible attributes of the customer entity set are customer-id,
customer-name, customer-street, and customer-city.
• Other examples: course name, deptname, departure time, age,
room
• For each attribute, there is a set of permitted values, called the
domain, or value set, of that attribute.
5
Attributes
• Single-valued vs Multi-valued:
• Single valued attributes have a single value for a particular entity
while Multi-valued attributes have a set of values for a specific entity.
• Eg. color of car could be multi-valued
• salary of employee is single-valued
• Atomic vs Composite:
• Atomic attributes are not divided into subparts while Composite
attributes can be divided into subparts (other attributes).
• Eg. age of a person is atomic
• address of a person could be composite
• Stored vs Derived:
• Derived attributes are those that can be derived from other attributes
or entities, e.g., age can be derived from date of birth.
• All other attributes are stored attributes
6
Composite attributes
7
Relationships
• Relationship:
• An association between multiple entities
• Relationship Set:
• A collection of relationships all belonging to one relationship
type.
• A relationship may also have attributes called descriptive
attributes.
• It may be Unary, Binary, Ternary, 4-nary relationship sets
8
Relationship
Relationship set borrower
9
Weak Entity Sets
• Entity sets that do not have sufficient attributes to form a key
are called weak entity sets.
• For a weak entity set to be meaningful, it must be associated
with another entity set, called the identifying or owner entity
set.
• So, a weak entity set existentially depend upon (one or more)
strong owner entity sets from whom they derive their key.
• A weak entity set may have a discriminator (or a partial key)
that distinguish between weak entities related to the same
strong entity
• key of weak entity set = Key of owner entity set(s) +
discriminator
10
Weak Entity Sets(Contd.)
Example:
Consider the entity set payment, which has the three attributes:
payment-number, payment-date, and payment-amount.
• Payment numbers are typically sequential numbers, starting
from 1, generated separately for each loan.
• Although each payment entity is distinct, payments for different
loans may share the same payment number.
• Thus, this entity set does not have a primary key; it is a weak
entity set.
11
ER Diagram
12
Example: Weak Entity Set Notations
• Double rectangles for weak entity set
• Double diamond for weak entity relationship
• Dashed underscore for discriminator
13
Structural Constraints
• Two main types of restrictions on relationships are:
• Cardinality Constraints
• Participation Constraints
• Cardinality Constraints is the number of instances of one
entity that can or must be associated with each instance
of another entity
14
Cardinality Constraints on Relationship
Sets
• Consider binary relationship set R
between entity sets A and B
• One to one: an entity in A is associated
with at most one entity in B, and an entity
in B is associated with at most one entity
in A.
• an employee has only one spouse in a married-
to relationship.
15
Cardinality Constraints on Relationship
Sets(Contd.)
• One to many. An entity in A is associated
with any number (zero or more) of
• entities in B. An entity in B, however, can
be associated with at most one entity
in A.
• A customer can order different items online.
16
Cardinality Constraints on Relationship
Sets(Contd.)
• Many to One: An entity in A is
associated with at most one entity in B,
an entity in B is associated with many
entities in A.
• an employee works in a single department
but a department consists of many
employees.
17
Cardinality Constraints on Relationship
Sets(Contd.)
• Many to Many: An entity in A is associated
with many entities in B, and an entity in B
is associated with many entities in A.
• A customer may have many bank accounts.
Accounts may be joint between multiple
customers.
18
19
Alternative Cardinality Specification
Both many and 1 include 0.
Meaning some entity may not participate in the relationship
20
Alternative Cardinality Specification
21
Participation Constraints
• Total Participation:
• The participation of an entity set in a relationship set is said to be
total if every entity from the entity set participates in at least one
relationship of the relationship set.
• Partial Participation:
• If only some entities from entity sets participates in relationships of
relationship set, then the participation is called partial.
22
Total participation
• When we require all entities to participate in the
relationship (total participation), we use double lines to
specify
• A double line from loan to borrower indicates that each
loan must have at least one associated customer.
23
Keys
• A key allows to identify a set of attributes that suffice to
distinguish entities from each other.
• A super key of an entity set is a set of one or more attributes that,
taken collectively, allow to identify uniquely an entity in the entity
set.
• A candidate key of an entity set is a minimal super key.
i.e. it uniquely identifies any database record without referring to any other
data.
• Although several candidate keys may exist, one of the candidate
keys is selected to be the primary key.
24
Key Examples
• Suggest super keys for the following entity?
• What are the candidate keys?
• Primary key?
25
Degree of Relationship
• Degree of a relationship is the number of entity types that
participate in it
One entity
related to
another of
the same
entity type
Entities of two
different
types related
to each other
Entities of three
different types
related to each
other
26
Unary relationship(Role indicator)
• The labels “manger” and “worker” are called roles the self relationship
• More Examples?
• People to people
• Parent – children
• Manager – employee
• Husband – wife
• Word to word
• Root – synonym
27
Role indicator
• The function that an entity plays in a relationship is called
its role
• Roles are normally not explicitly specified unless the
meaning of the relationship needs clarification
• Roles needed when entity set is related to itself via a
relationship.
28
Ternary Relationship
29
Example
30
Extended ER Features
• Generalization and Specialization
• Aggregation
31
Generalization and Specialization
• A lower-level entity set inherits all the attributes and
relationship participation of the higher-level entity set to which it
is linked.
• A lower-level entity set may have additional attributes and
participate in additional relationships.
• Generalization is a bottom-up approach in which two or more
lower level entities combine to form a higher level entity.
• In generalization, the higher level entity can also combine with
other lower level entity to make further higher level entity.
• Specialization is a top-down approach in which one higher
level entity can be broken down into two or more lower level
entity.
32
Generalization and Specialization
33
Aggregation
• One limitation of the E-R model is that it cannot express relationships among
relationships.
• consider the ternary relationship “works-on” between a employee, branch,
and job.
• suppose we want to record managers for tasks performed by an employee at
a branch.
• One alternative for representing this
relationship is to create a quaternary
relationship manages between
employee, branch, job, and manager.
• There is redundant information in the
resultant figure.
34
Aggregation
• Aggregation is an abstraction through which relationships are
treated as higher level entities.
• Aggregation is a process when relation between two entity is
treated as a single entity.
35

Weitere ähnliche Inhalte

Was ist angesagt?

Tree in data structure
Tree in data structureTree in data structure
Tree in data structureghhgj jhgh
 
Unit 1 introduction to data structure
Unit 1   introduction to data structureUnit 1   introduction to data structure
Unit 1 introduction to data structurekalyanineve
 
Terminology of tree
Terminology of treeTerminology of tree
Terminology of treeRacksaviR
 
Data structure - Graph
Data structure - GraphData structure - Graph
Data structure - GraphMadhu Bala
 
linked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutoriallinked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy TutorialAfzal Badshah
 
B+tree Data structures presentation
B+tree Data structures presentationB+tree Data structures presentation
B+tree Data structures presentationMuhammad Bilal Khan
 
heap Sort Algorithm
heap  Sort Algorithmheap  Sort Algorithm
heap Sort AlgorithmLemia Algmri
 
Searching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And AlgorithmSearching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And Algorithm03446940736
 
Binary Search Tree in Data Structure
Binary Search Tree in Data StructureBinary Search Tree in Data Structure
Binary Search Tree in Data StructureMeghaj Mallick
 
Priority Queue in Data Structure
Priority Queue in Data StructurePriority Queue in Data Structure
Priority Queue in Data StructureMeghaj Mallick
 
Data Structures - Lecture 7 [Linked List]
Data Structures - Lecture 7 [Linked List]Data Structures - Lecture 7 [Linked List]
Data Structures - Lecture 7 [Linked List]Muhammad Hammad Waseem
 

Was ist angesagt? (20)

B and B+ tree
B and B+ treeB and B+ tree
B and B+ tree
 
Tree in data structure
Tree in data structureTree in data structure
Tree in data structure
 
Unit 1 introduction to data structure
Unit 1   introduction to data structureUnit 1   introduction to data structure
Unit 1 introduction to data structure
 
Terminology of tree
Terminology of treeTerminology of tree
Terminology of tree
 
Binary tree
Binary  treeBinary  tree
Binary tree
 
Bfs and Dfs
Bfs and DfsBfs and Dfs
Bfs and Dfs
 
AVL Tree Data Structure
AVL Tree Data StructureAVL Tree Data Structure
AVL Tree Data Structure
 
Data structure - Graph
Data structure - GraphData structure - Graph
Data structure - Graph
 
linked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutoriallinked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutorial
 
ER MODEL
ER MODELER MODEL
ER MODEL
 
B+tree Data structures presentation
B+tree Data structures presentationB+tree Data structures presentation
B+tree Data structures presentation
 
Heap_Sort1.pptx
Heap_Sort1.pptxHeap_Sort1.pptx
Heap_Sort1.pptx
 
AVL Tree in Data Structure
AVL Tree in Data Structure AVL Tree in Data Structure
AVL Tree in Data Structure
 
heap Sort Algorithm
heap  Sort Algorithmheap  Sort Algorithm
heap Sort Algorithm
 
Searching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And AlgorithmSearching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And Algorithm
 
Singly link list
Singly link listSingly link list
Singly link list
 
Binary Search Tree in Data Structure
Binary Search Tree in Data StructureBinary Search Tree in Data Structure
Binary Search Tree in Data Structure
 
B trees dbms
B trees dbmsB trees dbms
B trees dbms
 
Priority Queue in Data Structure
Priority Queue in Data StructurePriority Queue in Data Structure
Priority Queue in Data Structure
 
Data Structures - Lecture 7 [Linked List]
Data Structures - Lecture 7 [Linked List]Data Structures - Lecture 7 [Linked List]
Data Structures - Lecture 7 [Linked List]
 

Ähnlich wie Er model

Ähnlich wie Er model (20)

ERD(2).ppt
ERD(2).pptERD(2).ppt
ERD(2).ppt
 
Revision ch 3
Revision ch 3Revision ch 3
Revision ch 3
 
Entityrelationshipmodel
EntityrelationshipmodelEntityrelationshipmodel
Entityrelationshipmodel
 
ER Model in the Database Computer Science.pdf
ER Model in the Database Computer Science.pdfER Model in the Database Computer Science.pdf
ER Model in the Database Computer Science.pdf
 
Dbms Model.pdf
Dbms Model.pdfDbms Model.pdf
Dbms Model.pdf
 
Data Models.pptx
Data Models.pptxData Models.pptx
Data Models.pptx
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship Model
 
entityrelationshipmodel.pptx
entityrelationshipmodel.pptxentityrelationshipmodel.pptx
entityrelationshipmodel.pptx
 
Day 1 SQL.pptx
Day 1 SQL.pptxDay 1 SQL.pptx
Day 1 SQL.pptx
 
SQL.pptx
SQL.pptxSQL.pptx
SQL.pptx
 
Entity-Relationship Data Model
Entity-Relationship Data ModelEntity-Relationship Data Model
Entity-Relationship Data Model
 
Database design
Database designDatabase design
Database design
 
18306_lec-2 (1).ppt
18306_lec-2 (1).ppt18306_lec-2 (1).ppt
18306_lec-2 (1).ppt
 
ER Modeling and Introduction to RDBMS
ER Modeling and Introduction to RDBMSER Modeling and Introduction to RDBMS
ER Modeling and Introduction to RDBMS
 
database.pptx
database.pptxdatabase.pptx
database.pptx
 
ER-Model-ER Diagram
ER-Model-ER DiagramER-Model-ER Diagram
ER-Model-ER Diagram
 
ICT DBA3 09 0710 Model Data Objects.pdf
ICT DBA3 09 0710 Model Data Objects.pdfICT DBA3 09 0710 Model Data Objects.pdf
ICT DBA3 09 0710 Model Data Objects.pdf
 
Er model
Er modelEr model
Er model
 
Basic database analysis(database)
Basic database analysis(database)Basic database analysis(database)
Basic database analysis(database)
 
lecture2.pdf
lecture2.pdflecture2.pdf
lecture2.pdf
 

Kürzlich hochgeladen

TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxUmeshTimilsina1
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 

Kürzlich hochgeladen (20)

TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 

Er model

  • 2. ER Model • The entity-relationship model (or ER model) is a high-level conceptual data model representing the logical relationships of entities (or objects) in order to create a database and is widely used to develop an initial database design. • ER model was first proposed by Peter Pin-Shan Chen of Massachusetts Institute of Technology (MIT) in the 1970s. • The diagrammatic notation used in the ER model for representing entities with properties and their relationships is known as ER diagrams. 2
  • 3. Entity and Entity Sets • Entities • An entity is a “thing” or “object” in the real world that is distinguishable from all other objects. For example, each person in an enterprise is an entity. • Entity Sets • An entity set is a set of entities of the same type that share the same properties, or attributes. • Set of all persons who are customers at a given bank can be defined as the entity set customer. • Other examples: students, courses, employees, departments, flights, patients. 3
  • 4. Entity and Entity Sets Entity Sets Customer and Loan 4
  • 5. Attributes • Attributes are descriptive properties possessed by each member of an entity set. • Possible attributes of the customer entity set are customer-id, customer-name, customer-street, and customer-city. • Other examples: course name, deptname, departure time, age, room • For each attribute, there is a set of permitted values, called the domain, or value set, of that attribute. 5
  • 6. Attributes • Single-valued vs Multi-valued: • Single valued attributes have a single value for a particular entity while Multi-valued attributes have a set of values for a specific entity. • Eg. color of car could be multi-valued • salary of employee is single-valued • Atomic vs Composite: • Atomic attributes are not divided into subparts while Composite attributes can be divided into subparts (other attributes). • Eg. age of a person is atomic • address of a person could be composite • Stored vs Derived: • Derived attributes are those that can be derived from other attributes or entities, e.g., age can be derived from date of birth. • All other attributes are stored attributes 6
  • 8. Relationships • Relationship: • An association between multiple entities • Relationship Set: • A collection of relationships all belonging to one relationship type. • A relationship may also have attributes called descriptive attributes. • It may be Unary, Binary, Ternary, 4-nary relationship sets 8
  • 10. Weak Entity Sets • Entity sets that do not have sufficient attributes to form a key are called weak entity sets. • For a weak entity set to be meaningful, it must be associated with another entity set, called the identifying or owner entity set. • So, a weak entity set existentially depend upon (one or more) strong owner entity sets from whom they derive their key. • A weak entity set may have a discriminator (or a partial key) that distinguish between weak entities related to the same strong entity • key of weak entity set = Key of owner entity set(s) + discriminator 10
  • 11. Weak Entity Sets(Contd.) Example: Consider the entity set payment, which has the three attributes: payment-number, payment-date, and payment-amount. • Payment numbers are typically sequential numbers, starting from 1, generated separately for each loan. • Although each payment entity is distinct, payments for different loans may share the same payment number. • Thus, this entity set does not have a primary key; it is a weak entity set. 11
  • 13. Example: Weak Entity Set Notations • Double rectangles for weak entity set • Double diamond for weak entity relationship • Dashed underscore for discriminator 13
  • 14. Structural Constraints • Two main types of restrictions on relationships are: • Cardinality Constraints • Participation Constraints • Cardinality Constraints is the number of instances of one entity that can or must be associated with each instance of another entity 14
  • 15. Cardinality Constraints on Relationship Sets • Consider binary relationship set R between entity sets A and B • One to one: an entity in A is associated with at most one entity in B, and an entity in B is associated with at most one entity in A. • an employee has only one spouse in a married- to relationship. 15
  • 16. Cardinality Constraints on Relationship Sets(Contd.) • One to many. An entity in A is associated with any number (zero or more) of • entities in B. An entity in B, however, can be associated with at most one entity in A. • A customer can order different items online. 16
  • 17. Cardinality Constraints on Relationship Sets(Contd.) • Many to One: An entity in A is associated with at most one entity in B, an entity in B is associated with many entities in A. • an employee works in a single department but a department consists of many employees. 17
  • 18. Cardinality Constraints on Relationship Sets(Contd.) • Many to Many: An entity in A is associated with many entities in B, and an entity in B is associated with many entities in A. • A customer may have many bank accounts. Accounts may be joint between multiple customers. 18
  • 19. 19
  • 20. Alternative Cardinality Specification Both many and 1 include 0. Meaning some entity may not participate in the relationship 20
  • 22. Participation Constraints • Total Participation: • The participation of an entity set in a relationship set is said to be total if every entity from the entity set participates in at least one relationship of the relationship set. • Partial Participation: • If only some entities from entity sets participates in relationships of relationship set, then the participation is called partial. 22
  • 23. Total participation • When we require all entities to participate in the relationship (total participation), we use double lines to specify • A double line from loan to borrower indicates that each loan must have at least one associated customer. 23
  • 24. Keys • A key allows to identify a set of attributes that suffice to distinguish entities from each other. • A super key of an entity set is a set of one or more attributes that, taken collectively, allow to identify uniquely an entity in the entity set. • A candidate key of an entity set is a minimal super key. i.e. it uniquely identifies any database record without referring to any other data. • Although several candidate keys may exist, one of the candidate keys is selected to be the primary key. 24
  • 25. Key Examples • Suggest super keys for the following entity? • What are the candidate keys? • Primary key? 25
  • 26. Degree of Relationship • Degree of a relationship is the number of entity types that participate in it One entity related to another of the same entity type Entities of two different types related to each other Entities of three different types related to each other 26
  • 27. Unary relationship(Role indicator) • The labels “manger” and “worker” are called roles the self relationship • More Examples? • People to people • Parent – children • Manager – employee • Husband – wife • Word to word • Root – synonym 27
  • 28. Role indicator • The function that an entity plays in a relationship is called its role • Roles are normally not explicitly specified unless the meaning of the relationship needs clarification • Roles needed when entity set is related to itself via a relationship. 28
  • 31. Extended ER Features • Generalization and Specialization • Aggregation 31
  • 32. Generalization and Specialization • A lower-level entity set inherits all the attributes and relationship participation of the higher-level entity set to which it is linked. • A lower-level entity set may have additional attributes and participate in additional relationships. • Generalization is a bottom-up approach in which two or more lower level entities combine to form a higher level entity. • In generalization, the higher level entity can also combine with other lower level entity to make further higher level entity. • Specialization is a top-down approach in which one higher level entity can be broken down into two or more lower level entity. 32
  • 34. Aggregation • One limitation of the E-R model is that it cannot express relationships among relationships. • consider the ternary relationship “works-on” between a employee, branch, and job. • suppose we want to record managers for tasks performed by an employee at a branch. • One alternative for representing this relationship is to create a quaternary relationship manages between employee, branch, job, and manager. • There is redundant information in the resultant figure. 34
  • 35. Aggregation • Aggregation is an abstraction through which relationships are treated as higher level entities. • Aggregation is a process when relation between two entity is treated as a single entity. 35

Hinweis der Redaktion

  1. Example: Employee assigned to project. Student gets scholarship. Students apply for scholarship.
  2. A person is married to a person, employee supervises employee.