DBMS Second Chapter 2011
DBMS Second Chapter 2011
Model
Chapter2: Entity Relationship Model
(T2: 42-65)
Functional requirements
User defined operations that are applied to the
database
Include updates and retrieval
DFDs, Sequence diagram, scenarios can be
used to define
Database requirements
Data and data type to be stored
Constraints applied on data
1 1 1
MANAGES
supervisor supervisee CONTROLS
Hour
1 SUPERVISION N s N
M N
WORKS_ON
PROJECT
DEPENDENTS_OF
N Name
Locations
Number
An ER Schema diagram
for the COMPANY
DEPENDENT
Database
Name
16 B.S.Shankar, Dept of MCA, VVIET
Sex DOB Relationship
ER Model
Composite
If components of the composite attributes have to
be referred, it is necessary to store the
components separately.
If composite attribute is referred only as a whole,
there is no need to subdivide it into component
attributes e.g. if address has to be referred as a
whole only, there is no need to divide it.
Single-valued
Only single value for a particular entity e.g. DOB
Multi-valued
An entity may have multiple values for that
attribute.
Multiple value may have lower and upper bounds
on the number of values.
For example,
Color of a CAR: {Color}
phone_numbers: {phone number}
24 B.S.Shankar, Dept of MCA, VVIET
Types of Attributes
Stored attributes
Stored in the database
Derived attributes
Can be computed from other related attributes
E.g. Birthdate ---stored
Age ----derived
For example:
{Address_phone (
‘type of entity’
‘set of entity’
A : E P(V)
EMPLOYEE DEPARTMENT
DOB
StartDate
1
1
MANAGES
EMPLOYEE WORKS_FOR
DEPARTMENT
● e1 ■ r1
● e2
● e3
■ r2 ● d1
● e4 ■ r3 ● d2
● e5 ● d3
■ r4
•••
● e6
■ r5
•••
● e7
■ r6
•••
■ r7 Binary Relationship
53 B.S.Shankar, Dept of MCA, VVIET
Degree of Relationships Type
Binary Relationship
EMPLOYEE PROJECT
WORKS_ON
Ternary Relationship
SUPPLIER
SUPPLY PROJECT
PART
56 B.S.Shankar, Dept of MCA, VVIET
Some relationship instances in the
‘SUPPLY’ ternary relationship set
SUPPLIER
SUPPLY
● S1
PROJECT
● S2 ■ r1
•••
● j1
● j2
PART ■ r2
•••
● P1
● P2 ■ r3
● P3
•••
Initial Lname
Fname
Address
Name
ENO Sex Salary
EMPLOYEE
DOB
supervisor supervisee
1 N
SUPERVISE
EMPLOYEE SUPERVISION
1
● e1
2
■ r1
e1 ● e2 1
e2 e3 ● e3
2
■ r2
e4 e5 ● e4 1
2
● e5 ■ r3
2 1
•••
■ r4
61 B.S.Shankar, Dept of MCA, VVIET
Constraints on Relationships
EMPLOYEE MANAGES
DEPARTMENT
● e1
● e2 ■ ● d1
● e3 r1
● d2
● e4 ■ ● d3
● e5 •••
r2
•••
•••
● e6 ■
● e7 r3
EMPLOYEE HAS
DEPPENDENT
● e1
● e2
■
r1 ● d1
● e3
● e4 ■ ● d2
r2 ● d3
● e5 ● d4
■
•••
● e6
•••
● e7 r3
■
r4
67 B.S.Shankar, Dept of MCA, VVIET
1:1 & 1:N Relationships: Example
EMPLOYEE WORKS_FOR
• e1 ■ r1 DEPARTMENT
• e2 ■ r2 ● D1
• e3 ■ r3 ● D2
• e4 ■ r4
•••
•••
•••
• e1 ■ r1 PROJE CT
• e2 ■ r2 ● P1
• e3 ■ r3 ● P2
• e4 ■ r4
● P3
■ r5
•••
● P4
■ r6
•••
■ r7
•••
Total Participation
Partial participation
name Salary
ENO Sex
Address
EMPLOYEE
DOB
HAS_DEPENDENT
DEPENDENT
Name
Sex DOB Relationship
80 B.S.Shankar, Dept of MCA, VVIET
Refining the ER Design for the
Company Database
ENTITY
WEAK ENTITY
RELATIONSHIP
IDENTIFYING RELATIONSHIP
85 B.S.Shankar, Dept of MCA, VVIET
Notations for ER Diagrams (contd..)
DERIVED ATTRIBUTE
MULTIVALUED ATTRIBUTE
E1 R E2 TOTAL PARTICIPATION OF E2 IN R
STRUCTURAL CONSTRAINT
(min,max)
R E (min,max) ON PARTICIPATION OF
E IN R
Or (min, max)
dependent Name
(1,1)
Locations
Number
ER diagram for the
COMPANY Schema, with
structural constraints DEPENDENT
specified using (min,max)
notation.
92 Name B.S.Shankar, Dept of MCA, VVIET
Sex Relationship
DOB
Ternary Relationship: SUPPLY