Conceptual Modeling With ER Diagrams
Conceptual Modeling With ER Diagrams
with ER Diagrams
Peter Chen
introduced ER Diagrams
E-R Modeling
E-R Modeling is a design methodology for
modeling the
Entities
Relationships
using a diagram with specified shapes for
entities, relationships, roles of entities in these
relationships, and cardinality.
Meaning
Entity Type
Identifying Relationship
Attribute
Symbol
Meaning
Key Attribute
Multivalued Attribute
Composite Attribute
Employee
Name
SSNum
Employee
Name
Project
Assigned
Date
Payroll Application
A contractor does custom work (projects). He
keeps track of employee time for each project.
Besides materials, the customer is charged by
invoice for employee time on his job. To keep
track of employee time, the employee submits a
time sheet with entries of project number, hours,
description. These are entered into the system
along with the employee ID. The hourly rate for
the employee is used for each entry to generate
a labor charge. The labor charges are totaled
for each project and used as a basis for the
customer invoice.
Analysts
E-R Modeling
E-R Modeling
Entity Sets, Attributes, Relationships
Racquet Club Example Continued
Entity Sets
Members : Name, Start, Contract_Amount,
Contract_Period, Initial_Balance, Member_ID
Payments : PayerID, Amount, Paid_Date,
Payment_ID
Reservations : Member_ID, CourtNumber, Hour
Relations :
Member - Makes Payment
Member - Makes - Reservation
Data Modeling
Racquet Club Example
Meaning
Calculated Attribute
Cardinality Constraints
and
Participation Constraints
0 .. *
0 .. 1
1 .. *
1 .. 1
Library
Circulation
Motel/Hotel
Video Store
Employment
Company
Library
Circulation
Motel/Hotel
Video Store
Employment
Company
Pennsylvania Customer
Participation Constraints
A participation constraint is a lower bound on the
number of times an entity can particpate in a
relation.
Examples:
An employee belongs to ONE department. This is a
participation and a cardinality constraint 1 .. 1.
Employee
0 .. *
0 .. 1
1 .. *
1 .. 1
Department
Participation constraints.
Employee
Assigned
To
Project
Num-Hours
A customer will pay for
at least one project
Customer
Project
Will Pay
For
Fixed-Cost
Reports_To
Employee
supervisor
Three Sets :
Sale( ProdID, CustID,SuppID;Date)
Customer
Date
Sold
Supplier
Product
Price
Name
Customer
CustID
Address
Has
Name
Description
Total
CustID
Projects
ProjID
PayRate
Employee
EmpID
SSNo
Has
Year
EmpID
TimeSheet
Month
TSID
Has
Has
TSID
TSID
...
Amount
Labor Charges
PayCheck
...
NetPay
Name
SSNo
Is-A
Salaried
Employee
Salary
disjoint
Hourly
Employee
PayRate
Construct an ER Diagram
Lawn Furniture Manufacturer
Stores Information for Catalog of products
and parts
Stores Information for Manufacturing,
including quantity on hand
Identify product entities (picnic table and
lawn chair) with attributes
Identify relationships IsA and PartOf
Picnic_Table
Price
ProdNo
Price
Part_Of
Top
Seats
Base
Price
ProdNo
Quantity
ProdNo
From ER Diagrams
to Relational Database Schema
Translating Entities
Employee
Name
SSNo
Type
Termination
HireDate
From ER Diagrams
to Relational Database Schema
Translating Relationships
Customer
SaleDate
Sold
Supplier
SaleID
Product
Price
Name
SSNo
Is-A
Salaried
Employee
Salary
disjoint
Hourly
Employee
PayRate
Picnic_Table
Price
ProdNo
Price
Part_Of
Top
Seats
Base
Price
ProdNo
Quantity
ProdNo