Data Base Design Steps 1.Define Entity Classes (Relations/Tables) and Keys. 2.Define Relationships between Entity Classes. Normalization Steps Eliminate all M:M relationships Assure all fields are dependent only on the Primary Key Remove all calculated fields 3.Define Fields in the Relation. 4.Using the Data Definition Language, create the data base.
Video Rental Example – Step 1 Tracking the rental of videos in a store Step 1. Define the Entity Classes + Primary Key Customer ( ID, Name, Address, Phone #, # of Videos Rented) Videos ( ID, Type, Days Rented, Rental Price, Distributor, Phone #)
Video Rental Example – Step 2 Step 2 - Define Relationships between Entity Classes Entity Relationship Diagrams (ERD) Customer Video Required Optional Many One
Video Rental Example – Step 2 a. Normalization a. Eliminate all M:M relationships Customer Video RentalVideo Video Rental Customer ID Video ID Date Rented Date Returned Composite Primary Key
Video Rental Example – Step 2 b. Normalization b. Assure all fields are dependent on the Primary Key Customer ( ID, Name, Address, Phone #, # of Videos Rented) Videos ( ID, Type, Days Rented, Rental Price, Distributor, Phone # ) Distributor ( ID, Distributor Name, Phone #) Customer Video Rental Video Distributor
Video Rental Example – Step 2 c. Normalization c. Remove all calculated fields Customer ( ID, Name, Address, Phone #, # of Videos Rented) Customer Video Rental Video Distributor Field can be calculated
Video Rental Example – Step 3 Step 3 - Define Fields in the Relation Numeric- Required or Optional Alphanumeric- Default Value Currency- Pull Down List Length- Indexed
Video Rental Example – Step 4 Step 4 - Using the Data Definition Language, create the data base.