Download presentation
Presentation is loading. Please wait.
Published byRolf Wood Modified over 8 years ago
1
Normalisation Worked example for an Order Remember : The data should depend upon the key, the whole key and nothing but the key.
2
Anderson Garden Centre - Order Order Number : 1235 Cust. No : JA007 Cust. Name : Jim Anderson Date : 17-May-2008 Product Description Quantity Unit No Price 3785 Wheel Barrow 1 £23.99 8798 Watering Can 5 £5.99 3439 Garden Shed 1 £350.00 This slide shows one of the garden centre’s orders. What attribute would you select to be a unique identifier? Is there any information that repeats?
3
Unnormalised Form UNF ORDER #Order No Cust No Cust Name Date #Product No Description Quantity Unit Price Order number has been chosen as the unique identifier. A unique identifier for the repeated group has been chosen and the repeated data italicised. The repeated data should now be removed into a separate relation and original key added to maintain identity. Primary Key Entity Name
4
First Normal Form UNF 1NF ORDER #Order No Cust. No Cust. Name Date #Product No Description ORDER ITEM Quantity #Order No Unit Price #Product No Description Quantity Price The original relation has been named as ORDER. The repetition of product information has been removed into a separate relation and the original key brought down. Remove non-key attributes and depending key into separate relation
5
Second Normal Form UNF 1NF 2NF ORDER ORDER ORDER #Order No #Order No #Order No Cust. No Cust. No Cust No Cust. Name Cust. Name Cust Name Date Date Date #Product No Description ORDER ITEM ORDER ITEM Quantity #Order No #Order No Unit Price #Product No #Product No Description Quantity Quantity Price PRODUCT #Product No Description Price Description & Price only depend on Product and are removed along with depending key into a separate relation Do all non-key attributes depend on the primary key or are there any inter data dependencies?
6
Third Normal Form UNF 1NF 2NF 3NF ORDER ORDER #Order No #Order No Cust No Cust No Cust No * Cust No Cust Name Cust Name Cust Name Date Date Date Date #Product No ORDER ITEM Description ORDER ITEM ORDER ITEM #Order No Quantity #Order No #Order No #Product No Unit Price #Product No #Product No Quantity Quantity Quantity Price PRODUCT PRODUCT #Product No #Product No Price Description Price CUSTOMER Cust No Cust Name Customer name depends on Customer No. Customer No remains in the Order relation as a foreign key linking to the primary key of the new relation, CUSTOMER
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.