Entity relationship diagram is a symbolic representation of database relations. Each
symbol in entity relationship diagram has separate meaning. Every Entity appears in
rectangle and attributes appears in oval shape. Relationship appears inside diamond.
ER diagram represents relationship between different entities in database table.
Consider a company has departments such as sales, purchase, and billing.
Entity relationship diagram for company database have the following statements
• A company has departments and employees.
• A department must have at least one employee and can contain more than one
employee.
• One company employee can work only in one department.
Entities in the company database are
• Employee
• Sales Department
• Supervising
• billing
Attributes of employee table are employee ID, employee name, join date, phone number.
Attributes of sales Department table are employee ID, employee name, product name,
quantity.
Attributes of supervisor table are employee ID, employee name, attendance, date and
time, no of bills.
Attributes of billing table are employee ID, billing number, product name, price, quantity,
bill amount.
Identifying the relationship between entities:
• Sales department has many employees. So entities sales Department and
employee has one to many relationships.
• Sales department has many employees and they are supervised by one supervisor.
So entities sales Department and supervisor has many to one relationship.
• Many employees in sales department take products to billing section. So entities
billing and sales Department has one to many relationships.
ER diagram for company database:
Employee M
Has
Employee ID Many
Employee name 1
Join date
Phone Number Sales Dept
Employee ID
Supervisor M Employee name
1
Product name
Guides Quantity
Employee ID
Employee name
Date and time M
Attendance
No of bills