Professional Documents
Culture Documents
Lec7 ER Examples
Lec7 ER Examples
Examples
1 a
Many-to-one: 2
3
b
c
d
1 a
b
One-to-many:
2
3 c
d
1 a
Many-to-many: 2
3
b
c
d
• Participation Constraints
Each product made by at most one company.
Some product made by no company?
• Weak Entity set
• identified uniquely by Product makes Company
considering the primary key of
another entity. Each product made by exactly one company
• Attribute of weak entity called
discriminator
Purchase Store
personAddr
personName
MA 518: Database Management Systems 11
Example 2
• A company database needs to store information about employees (identified
by ssn, with salary and phone as attributes), departments (identified by dno,
with dname and budget as attributes), and children of employees (with name
and age as attributes).
• Employees work in departments;
• each department is managed by an employee;
• a child must be identified uniquely by name when the parent (who is an employee;
assume that only one parent works for the company) is known.
• We are not interested in information about a child once the parent leaves the
company.
• Draw an ER diagram that captures this information (only major attributes
shown).
MA 518: Database Management Systems 12
DNO Dname
Works
SSN Salary in
(0,N) (0,N)
Phone Departments
Employees
(1,1)
(0,N)
(0,N)
Manages
budget
dependent
(1,1)
Children
cname