Download presentation
Presentation is loading. Please wait.
1
First Normal form For tutorial
2
TNF Exercise. Objective. –To practise the normalisation technique and to produce a set of optimised relations from the normalisation of six documents. Method. –1. Apply the rules of normalisation to the supplied documents. –2. Note the business rules.
3
How to get to 1NF Represent the form in Data Dictionary format (UnNormalisedFormat) –List fields, separated by +, surrounding repeating fields by {} Pick out a set of fields that make each example of the form unique, to make the PRIMARY KEY. – the name of the form or report is a clue Remove derived fields –E.g. sum, total, product (as in multiplication)
4
Contd Separate the repeating groups out, to make a new form, FORM2, leaving the non- repeating groups and the primary key as FORM1. Copy the primary key from FORM1 into FORM2 as a FOREIGN KEY. Pick a new PRIMARY key for FORM2.
5
Supplied Documents Product Sales Report Wellingtons Invoice Product Stock Report Sales Executive report New Product / Amendment Customer Amendment
6
Business Rules Product Code is not unique – each may have a number of pack sizes. Some Customers are allowed a discount. Each item has a Standard Price and up to 3 discount prices. A customer entitled to a discount has a single discount code A, B, C and will be charged the appropriate A, B or C price for all Products he orders. At any Warehouse, a Product is only stocked in one bin. The bin code may be considered unique to a warehouse. A customer deals with one, and only one, Sales Executive.
7
Product Sales Report
8
Unnormalised Product Sales Report
9
Unnormalised Form Product Code + PackSize + ProductDescription + {InvoiceNumber + InvoiceDate + CustomerNumber + CustomerName + InvoiceQuantity + LineValue}
10
First Normal Form ProductCode+PackSize + ProductDescription (ProductCode + PackSize) + InvoiceNumber + InvoiceDate + CustomerNumber + CustomerName + InvoiceQuantity + LineValue
11
First Normal form Product Sales Report
12
Invoice
13
Unnormalised Invoice
14
Unnormalised Form InvoiceNumber + InvoiceDate + CustomerNumber + CustomerName + CustomerInvoiceAddr + {ProductDescription + ProductCode + PackSize + StandardPrice + DiscountCode + DiscountPrice + InvoiceQuantity + LineValue} + InvoiceValue
15
First Normal Form InvoiceNumber + InvoiceDate + CustomerNumber + CustomerName + CustomerInvoiceAddr + DiscountCode InvoiceNumber + ProductCode + PackSize + ProductDescription + StandardPrice + DiscountPrice + InvoiceQuantity
16
First Normal Form
17
Product Stock Report
18
Unnormalised Product Stock Report
19
Unnormalised Form ProductCode + PackSize + Warehouse + StockQuantity + BinCode + NoOrdYTD + StockQuantityTotal + NoOrdYTDTotal
20
First Normal Form ProductCode + PackSize + StockQuantityTotal + NoOrdYTDTotal ProductCode + PackSize + Warehouse + StockQuantity + BinCode + NoOrdYTD
21
Unnormalised Product Stock Report
22
Sales Executive Report
23
Unnormalised Form SalesExecutive + CustomerNumber + OrdersYTD + ValueOrders + DiscountCode + OrdersYTDTotal + ValueOrdersTotal
24
First Normal Form SalesExecutive + OrdersYTDTotal + ValueOrdersTotal CustomerNumber + SalesExecutive + OrdersYTD + ValueOrders + DiscountCode
25
New Product / Amendment
26
Un-normalised Form ProductCode + PackSize + ProductDescription + PrescriptionIndicator + UnitQuantity + UKDrugRegNo + MinimumStock + DiscountCode + DiscountPrice
27
First Normal Form ProductCode + PackSize + ProductDescription + PrescriptionIndicator + UnitQuantity + UKDrugRegNo + MinimumStock ProductCode + PackSize + DiscountCode + DiscountPrice
28
Customer Amendment
29
Unnormalised Form CustomerNumber + SalesExecutive + PreferredCustomer + CustomerName + CustomerInvoiceAddr + CreditLimit + BulkPackOnly + DiscountCode + LicensedDrugVendor + CustomerDeliveryAddress
30
First Normal Form As for unnormalised form.
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.