You are on page 1of 15

Week 2 Case Study on ERD

DITP 1323 Basic Database Programming

‡ Generate all the business rules.Creating an ERD from the Case Study ‡ Identify all the entities. ‡ Identify all the relationships. .

Similarly. . there is a 1:M relationship between PATIENT and ORDER. Because the patient often receives several medications per day. each order can include several medications. creating a 1:M relationship between ORDER and MEDICATION. a patient staying in a hospital receives medications that have been ordered by a particular doctor.Example 1 ‡ Typically.

. but each painting can be exhibited in only one gallery. A gallery can exhibit many paintings. and that painting is exhibited in a particular gallery. Each artist can paint many paintings.Example 2 ‡ A painting is painted by a particular artist.

‡ Referring to the customer invoice. Product_Finish. and Unit_Price. . but must group at least one product. ‡ Another attribute fro product line is Product_Line_Name. while the identifier for a product line is Product_Line_ID. ‡ Each product must belong to exactly one product line. The company sells a number of different furniture products. ‡ These products are grouped into several product lines.Case Study (Pine Valley Furniture Company ) ‡ 1. ‡ The identifier for a product is Product_ID. ‡ A product line may group any number of products. we identify the following additional attributes for product: Product_Description.

Case Study ‡ 2. ‡ Each order is submitted by exactly one customer. ‡ Other attributes include Customer_Name and Customer_Address. ‡ A customer may submit any number of orders. . and another attribute is Order_Date. ‡ The identifier for a customer is Customer_ID. Customers submit orders for products The identifier fro an order is Order-ID. but need not submit any orders.

Case Study ‡ 3. ‡ An attribute associated with each order and product is Quantity. which is the number of units requested. . A given customer order must request at least one product. ‡ Any product sold by Pine Valley Furniture may not be requested on any order. or may be requested on one or more orders.

‡ Each customer does business in one or more of these sales territories. ‡ The identifier for a sales territory is Territory_ID. Pine Valley Furniture has established sales territories for its customers.Case Study ‡ 4. ‡ A sales territory may have any number of customers. . or may not have any customers doing business.

and Salesperson_Fax. The identifier for a salesperson is Salesperson_ID. Salesperson_Telephone. ‡ A salesperson serves exactly one sales territory. Pine Valley Furniture Company has several salespersons.Case Study ‡ 5. ‡ Each sales territory is served by one or more salespersons. . ‡ Other attributes include Salesperson_Name.

. Each product is assembled from one or more raw materials. ‡ The identifier for the raw material entity is Material_ID. ‡ Each raw material may be assembled into one or more products. ‡ Other attributes include Unit_of_Measure and Unit_Price.Case Study ‡ 6.

‡ Other attributes include Vendor_Name and Vendor_Address. ‡ Each raw material can be supplied by one or more vendors. ‡ An attribute of the relationship between vendor and raw material is Unit_Price . ‡ A vendor may supply any numver of raw materials. ‡ The identifier for a vendor is Vendor_ID.Case Study ‡ 7. or may not supply any raw materials to Pine Valley Furniture. Raw materials are supplied by vendors.

. ‡ Another attribute is Location. ‡ The identifier for a work center is Work_Center_ID. ‡ A work center may be used to produce any number of products. Each product is produced in one or more work centers. or may not be used to produce any products. Pine Valley Furniture has established a number of work centers.Case Study ‡ 8.

.Case Study ‡ 9. and Sill. ‡ An employee may have more than one skill. EmployeeAddress. ‡ Other attributes are Employee_Name. And Each skill can be mastered by many employees or none. The company has over 100 employees. ‡ The identifier for employee is Employee_ID.

Case Study ‡ 10: Each employee works in one or more work centers. but may have any number of employees. ‡ A work center must have at least one employee working in that center. .

. ‡ An employee who is a supervisor may supervise any number of employees. Each employee has exactly one supervisor.Case Study ‡ 11. but not all employees are supervisors.