Académique Documents
Professionnel Documents
Culture Documents
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.
Entity Type
Identifying Relationship
Attribute
Symbol
Multivalued Attribute
Composite Attribute
A entity is a object or event which needs to be tracked. Attributes characterize entity sets and relationships. Relationships relate two entity sets
Employee SSNum Name
Employee Name
Assigned Date
Project
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
Management know high level business rules End users have used paper system or previous software system and have expectations Analysts have understanding of what can / cannot be done and must requirements into system
E-R Modeling
A Racquet Club has members with one year or two year contracts. Members pay contract amount up front, quarterly, or monthly. Members may reserve a court for the next day.
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
Cardinality Constraints
and
Participation Constraints
0 .. *
0 .. 1
1 .. *
1 .. 1
1 .. 2 means that at least 1 d must participate in the A relation with C and that not more that 2 ds can participate. If A is represented by a table, then there is at least one row and not more than 2 rows with a single c value.
Book is_checked_out to Patron Customer rents a room Customer rents a video Applicant is hired for a job
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 Num-Hours
Project
A customer will pay for at least one project Customer Will Pay For Project
Fixed-Cost
Employee
supervisor
Reports_To
Sold
Product Price
Supplier
Description
Total
PayRate
EmpID
EmpID
Month
...
Amount
...
NetPay
Is-A
Salaried Employee
disjoint
Hourly Employee
Salary
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
ProdNo Part_Of
Price
Price
ProdNo
Top
Base Price
Create Table Employee ( Name char(20), Type char(1), HireDate date, Termination date, SSNo char(9), Primary Key (SSNo) )
Sold
Supplier
Create Table Sold ( SaleDate Date, Price Currency, SaleID autonumber, Customer Integer, Supplier Integer, Product Integer, Primary Key (SaleID), Foreign Key ( Customer ) References Customers( CustID), Foreign Key ( Supplier ) References Suppliers( SuppID ), Foreign Key ( Product ) References Products ProdID ) )
Is-A
Salaried Employee
disjoint
Hourly Employee
Salary
PayRate
Picnic_Table
ProdNo Part_Of
Price
Price
ProdNo
Top
Base Price