Order Database – ER Diagram Prepared by Channing Downing Spring 2016
Designing Databases with Entity Relationship Diagrams 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
Step 1: Define Entity Classes and Primary Keys 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 the database but not ordered by a customer. Entity Class Primary Key CUSTOMER CustomerID ORDER OrderID PRODUCT ProductID Business Rules 1. Customers can have multiple orders 2. Customers may no orders 3. Each order has one customer 4.Each order must have a customer 5. An order can have multiple products 6. An order must have 1 product 7. A product can have multiple orders 8. A product that has no orders
Step 2: Define Relationships Among Entity Classes Customer Order Product
Step 2: Define Relationships Among Entity Classes Customer Order ORDERITEM Product
Step 2: Define Relationships Among Entity Classes Customer Order ORDERITEM Product
Step 2: Define Relationships Among Entity Classes Business Rules 1. Customers can have multiple orders 2. Customers may no orders 3. Each order has one customer 4.Each order must have a customer 5. An order can have multiple products 6. An order must have 1 product 7. A product can have multiple orders 8. A product that has no orders Customer 2 1 3 4 Order 7 8 6 5 Product Won’t need this slide
Step 3: Define Attributes for each Table CUSTOMER CustomerID LastName FirstName Email Address ORDER OrderID CustomerID Product SerialNumber PRODUCT ProductID AmountOrdered OrderID ORDERITEM OrderID ProductID
Step 3: Define Attributes for each Table CUSTOMER CustomerID LastName FirstName EmailAddress Major Location Gender ORDER OrderID CustomerID OrderDate PRODUCT ProductID ProductName Price BatchSize Description Type ORDERITEM OrderID ProductID Quantity
(DBMS system - Microsoft Access) Step 4: Create Database http://students.uwyo.edu/cdownin2/IMGT2400/CowboyCookies.accdb (DBMS system - Microsoft Access)