L5-DBMS ER Model
L5-DBMS ER Model
Outline
1
16-Sep-20
2
16-Sep-20
ER Model Concepts
3
16-Sep-20
Simple
Each entity has a single atomic value for the attribute. For
example, SSN or Sex.
Composite
The attribute may be composed of several components. For
example, Address (Apt#, House#, Street, City, State,
ZipCode, Country) or Name (FirstName, MiddleName,
LastName). Composition may form a hierarchy where some
components are themselves composite.
Multi-valued
An entity may have multiple values for that attribute. For
example, Color of a CAR or PreviousDegrees of a STUDENT.
Denoted as {Color} or {PreviousDegrees}.
4
16-Sep-20
CAR
Registration(RegistrationNumber, State), VehicleID, Make, Model, Year, (Color)
car1
((ABC 123, TEXAS), TK629, Ford Mustang, convertible, 1999, (red, black))
car2
((ABC 123, NEW YORK), WP9872, Nissan 300ZX, 2-door, 2002, (blue))
car3
((VSY 720, TEXAS), TD729, Buick LeSabre, 4-door, 2003, (white, blue))
.
.
.
5
16-Sep-20
SUMMARY OF ER-DIAGRAM
NOTATION FOR ER SCHEMAS
Symbol Meaning
ENTITY TYPE
RELATIONSHIP TYPE
ATTRIBUTE
KEY ATTRIBUTE
MULTIVALUED ATTRIBUTE
COMPOSITE ATTRIBUTE
DERIVED ATTRIBUTE
E1 R E2 TOTAL PARTICIPATION OF E2 IN R
6
16-Sep-20
e1
r1 d1
e2 r2
e3 d2
r3
e4
r4
e5 d3
r5
e6
e7 r6
r7
7
16-Sep-20
r9
e1
r1 p1
e2 r2
e3 p2
r3
e4
r4
e5 p3
r5
e6
e7 r6
r7
r8
More than one relationship type can exist with the same
participating entity types. For example, MANAGES and
WORKS_FOR are distinct relationships between
EMPLOYEE and DEPARTMENT, but with different
meanings and different relationship instances.
8
16-Sep-20
9
16-Sep-20
Constraints on Relationships
10
16-Sep-20
e1
r1 d1
e2 r2
e3 d2
r3
e4
r4
e5 d3
r5
e6
e7 r6
r7
e1
r1 p1
e2 r2
e3 p2
r3
e4
r4
e5 p3
r5
e6
e7 r6
r7
r8
11
16-Sep-20
A RECURSIVE RELATIONSHIP
SUPERVISION
EMPLOYEE SUPERVISION
e1 2
1 r1
e2 2
1 r2
e3 2
1 r3
e4
2
e5 1
1 r4
e6
2
1
r5
e7
2
r6
© The Benjamin/Cummings Publishing Company, Inc. 1994, Elmasri/Navathe, Fundamentals of Database Systems, Second Edition
12
16-Sep-20
13
16-Sep-20
Structural Constraints –
one way to express semantics
of relationships
Structural constraints on relationships:
Cardinality ratio (of a binary relationship): 1:1, 1:N,
N:1, or M:N
SHOWN BY PLACING APPROPRIATE NUMBER ON THE
LINK.
Participation constraint (on each participating
entity type): total (called existence dependency) or
partial.
SHOWN BY DOUBLE LINING THE LINK
14
16-Sep-20
Examples:
A department has exactly one manager and an
employee can manage at most one department.
– Specify (0,1) for participation of EMPLOYEE in
MANAGES
– Specify (1,1) for participation of DEPARTMENT
in MANAGES
An employee can work for exactly one department
but a department can have any number of
employees.
– Specify (1,1) for participation of EMPLOYEE in
WORKS_FOR
– Specify (0,n) for participation of DEPARTMENT
in WORKS_FOR
15
16-Sep-20
(0,1) (1,1)
(1,1) (1,N)
16
16-Sep-20
Acknowledgement
Reference for this lecture is
17