Order Database – ER Diagram Prepared by Bryan Borcher Spring 2014
Step 1: Define Entity Classes and Primary Keys Step 2: Define Relationships Among Entity Classes Step 3: Define Attributes for each Table Step 4: Create Database Designing Databases with Entity Relationship Diagrams
Entity ClassPrimary Key ORDEROrderID CUSTOMERCustomerID PRODUCTProductID Step 1: Define Entity Classes and Primary Keys Business Rules A customer may have many orders. A customer may have no orders. Each Order has one Customer. Each Order must have a Customer. An Order must have one Product. An Order may have Multiple Products. A Product may have multiple Orders. A Product may have no Orders. There is not a limit to the number of orders a customer may place. Each customer can have one order, multiple orders, or be in your database without any orders. Each order is made by a single customer. Orders must have at least one product. Orders may have multiple products. The same product could be sold through many orders. Products can be listed in your database but not purchased.
Step 2: Define Relationships Among Entity Classes CUSTOMER PRODUCT ORDER
Step 3: Define Attributes for each Table CustomerIDFirstNameLastName AddressPhoneNumber CUSTOMER ProductIDProductNamePriceDescriptionBatchSize Type PRODUCT OrderID[CustomerID]Date ORDER OrderIDProductID Quantity ORDERITEM
Step 3: Define Attributes for each Table CustomerIDName Addressphonenumber CUSTOMER ProductIDProductNamePriceDescriptionBatchSize PRODUCT OrderID[CustomerID]Date[ProductID]Quantity ORDER TypeOrderID
Step 4: Create Database