Week 7 - ERD-1
Week 7 - ERD-1
2
Example COMPANY
Database
• Requirements of the Company
– The company is organized into DEPARTMENTs.
Each department has a name, number and an
employee who manages the department. We keep
track of the start date of the department manager.
– Each department controls a number of PROJECTs.
Each project has a name, number and is located at
a single location.
3
Example COMPANY Database
(Cont.)
Example
Rama, Raghu
Maker Towers, Hotel Cecil
ER Model Concepts
• Entity
• Entity type
• An entity type may have more than one key. For example,
the CAR entity type may have two keys:
– VehicleIdentificationNumber (popularly called VIN) and
– VehicleTagNumber (Number, State), also known as
license_plate number.
Entity Sets
• An entity set is a set of entities of the same type that
share the same properties.
– Example: set of all persons, companies, trees, holidays
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))
.
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
1 N
E1 R E2
CARDINALITY RATIO 1:N FOR E 1:E2 IN R
Summary of Symbols Used in
E-R Notation
ER DIAGRAM – Entity Types are:
EMPLOYEE, DEPARTMENT, PROJECT, DEPENDENT
Relationship
• A relationship relates two or more distinct entities with a
specific meaning.
• 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.
• A relationship set is a class of relationships of the same type,
having common properties
Attributes of Relationship types
e1 2
1 r1
e2 2
1
r2
e3 2
1
e4 2 r3
1
e5 1
2 r4
e6 1
2 r5
e7
r6
Recursive Relationship Type is: SUPERVISION
(participation role names are shown)
Weak Entity
PF account of an employee
Engineer of a ship
3 binary
relationships
A supplier can
There is 1 supplier
supply same part to
for every (project,
more than 1 project
part) combination
1 M
N
A supplier can
supply more than 1
part to a project