Please enable JavaScript.
Coggle requires JavaScript to display documents.
Entity Relationship Modelling - Coggle Diagram
Entity Relationship Modelling
Structural Constraints
Relate to entities that participate in a relationship;
Restrictions on relationships should reflect the ‘real world’;
Based on business rules;
E.g. a car must have an owner, a student can only have one Date of Birth
Main type of constraint is called “Multiplicity”.
TWO TYPES OF RESTRCTIIONS
Participation (all
Cardinality基数
Multiplicity Constraints – different notations
0:M
0:1
1:M
1:1
ER Modelling in DB Design
Data Modelling
Main components of ERD
Relationships
Relationships type
two or more entities participate
with a simple verb phrase (e.g. works at,has)
associations between entities
Written in the present tense 现在时 and descriptive
Relationship occurrence
Includes one occurrence from each participating entity type
Uniquely identifiable association
Relationship Degree PPT 图
Ternary relationship: three entities are associated
Quaternary relationship: four entities are associated
Binary relationship: two entities are associated
Recursive relationship: same entity type participates more than once in different roles.
Attributes
Attributes
Property or characteristic of the entity that the organisation wants to store;
Single value or multiple values
Each entity has a set of attributes
Named
Attribute Domain:Set of allowable values
Attributes tyoe
Composite Attribute
Composed of multiple components 多种组件 (e.g. address).
Multi-valued Attribute
Attribute with multiple values for each occurrence of an entity type (e.g. address; qualification, phoneNumber).
Single-valued Attribute
Has a single value for each entity occurrence;
Sometimes called ‘atomic原子’ attributes (e.g. studentID).
Derived Attribute
Attribute value is derivable from value of a related attribute (age)
Entities
Entity type
E.g. Students, Staff, Properties
Distinct group of objects
Refers to the entity set and not to a single entity occurrence
Entity occurrence
Refers to the entity set and not to a single entity occurrence
Unique or independent
existence
Same properties/attributes
Ussing a noun (e.g:branch, staff member)
KEYS
Primary Key - Candidate key selected to uniquely identify an entity.
Candidate Key - Minimal set of attributes that uniquely identifies an entity (alternate key/secondary key). ID, phone number
cannot be null (name 不是)
Strong/Weak Entities
Constraints
Cardinalities which indicate the minimum and maximum number of records that can exist in the target entity relative to one record (instance) in the source entity.
Other business rules
ER Approach
Most
common
method for database design;
First proposed by Chen (1976) and refined by many others
ERD represents the
Conceptual database
as viewed by end user
Strong/Weak Entities
Strong: Primary key of the related entity contains a primary key component of the parent entity
Weak:does not contain
Importance of Data Models
Organise data
for various users
Abstraction for the c
reation of a good database
Give an
overall view of the database
Communication
tool
Enhanced ER Model
Specialisation / Generalization
Attribute Inheritance
special types
Subclass
a distinct subgrouping of occurrences of an entity type
Superclass
Entity type
Specialisation
专业化 top-down ,have inheritance,maximizing, members
Generalisation
泛化 bottom-up, no inheritance,minimising,entity
Two constraints may apply to specialization/generalization:
disjoint constraints
May be disjoint
participation constraints
May be mandatory or optional