DirtBike Order Database– ER Diagram Prepared by William Sircin Fall 2012
Step 1: Define Entity Classes and Primary Keys Step 2: Define Relationships Among Entity Classes Step 3: Define Fields for each Relationship Step 4: Create Database Designing Databases with Entity Relationship Diagrams
Entity ClassPrimary Key CustomerCustomerID OrderOrderID ProductProductID DistributorDistributorID Step 1: Define Entity Classes and Primary Keys Business Rules Each customer can have one order Each customer can have multiple orders A customer can be in the database without any orders Each order is made by a single customer Orders cannot be blank The same product may be purchased through many orders Orders may have multiple products Products may be listed in the database and not ordered A distributor can supply multiple products Each distributor has to supply at least one product Each product must have one distributor
E-R Diagrams Use 5 symbols 1.Rectangle – entity class 2.Dotted line – relationship 3.| - single relationship 4.0 – zero/optional relationship 5.Crow’s foot ( ) – multiple relationship
PRODUCT CUSTOMER ORDER Step 2: Define Relationships Among Entity Classes DISTRIBUTOR DETAILED ORDERS
Step 3: Define Fields for each Relationship OrderIDProductIDQuantity DETAILED ORDERS DistributorIDDistributor DISTRIBUTOR ProductIDProductNameManufacturerColorMSRPIgnitionWeightQOHDistID PRODUCT OrderIDCustomerIDOrderDate ORDER CustomerIDLastNameFirstNameAddressCityStateZipPhone CUSTOMER
Step 4: Create Database (At this point we will begin working with our DBMS system, which will be Microsoft Access)