Professional Documents
Culture Documents
ER model-1
Week 5-6
ER Diagrams
Conceptual Design
• Model data independent of DBMS, application programs, programming
languages, hardware platform etc.
• Central Ideas
– Domains are made up of entities
– Relationships link associated Entities
– Entities and relationships have properties called attributes
– Certain attributes are special, call them primary keys and alternate keys
– Need integrity constraints to preserve domain consistency
• Deliverables
– ER Models - documented diagrammatically
– Data dictionary
– Documentation is an important component of ER modelling
Entity-Relationship (ER) Model
WEAK ENTITY
Key
TYPE
Attribute
RELATION Multi
SHIP TYPE value
attribute
IDENTIFYIN
G
RELATIONS
HIP TYPE
E1 R E2
composite
E1 N
R E2
(min,max) Derived
R E
attribute
Entity Type
• A group of objects with the same properties, which are identified by the enterprise as having
an independent existence
– not a formal definition
– Different designers may identify different entities
• Graphically,
• Rectangle
ENTITY
Entity type - Diagrammatic representation
• A rectangle labelled with the name of the entity
Student
Attributes
name
• For example staff has 4 attributes
– StaffNo
– Name Staff position
– Position
– Salary
salary
Enitity
Example: name, id, age & salary are attributes
in EMPLOYEE
salary name
entity salary
e1
age e2 id
e3 age
e4 EMPLOYEE
e5
e6
id
…
name
Employee Entity set
Composite attributes
• Composite attributes can be divided into
subparts.
surname middle_name
first_name
Try!
Graphically,
name age
Derived attribute
An exercise
stuNO stuName stuSub stuDob stuHrs stuYr stuGpa
stuGpa stuAge
3 Arts 18 Aug 16 1 0 19
Emldenmeery 1995
stuName
stuMajor
stuDob
stuHrs
stuYr
stuGpa
stuAge
key attribute
• A key attribute uniquely identifies an entity in
the entity set. salary
name
• Underlined age
e1
e2 id
e3
e4
EmpId e5
e6
Employee …
eid NID
• Therefore,
A key is a minimal set of attributes whose values
uniquely identify an entity in the set.
Relationship Types
N 1
EMPLOYEE Works in DEPARTMENT
relationship
Degree of Relationship type
• The number of participating entity types in a relationship.
LOCATION
descriptive attributes
• Sometimes, relationships can also have attributes
called descriptive attributes that record
information about the relationship.
since
• Graphically,
N 1
EMPLOYEE Works in DEPARTMENT
cardinality ratio
The cardinality ratio for a binary relationship specifies the
number of relationship instances that an entity can
participate in.
– one-to-one (1: 1)
– one-to-many (1 : N)
– many-to-many. (N : M)
one-to-many
• For example, an employee works in at most one department.
• Graphically,
N 1
EMPLOYEE Works in DEPARTMENT
M N
EMPLOYEE Works on PROJECT
try!!
Participation Constraint
Student?
Composite Entity
• M:N relationships
• Relational model can not handle M:N
Class- Class
Student
students
stno 1 N N
1 classid
• Determine
– Cardinality
1 M
EMPLOYEE Policy DEPENDENTS
id name age
supervisor subordinate
EMPLOYEE
When does an attribute become an entity?