Presentation is loading. Please wait.

Presentation is loading. Please wait.

WJEC Applied ICT Databases – Attributes & Entities Normalisation It is important in Database Design to make sure that the correct attributes are grouped.

Similar presentations


Presentation on theme: "WJEC Applied ICT Databases – Attributes & Entities Normalisation It is important in Database Design to make sure that the correct attributes are grouped."— Presentation transcript:

1 WJEC Applied ICT Databases – Attributes & Entities Normalisation It is important in Database Design to make sure that the correct attributes are grouped into the correct tables. Normalisation is a process that allows us to do this. This reduces the duplication of data and helps stop inconsistencies. Normalisation is done in three phases – 1NF, 2NF and 3NF. These are as follows 1)1NF – Atomic Data Test 2)2NF – Partial key dependence test 3)3NF – Non-key dependence test

2 WJEC Applied ICT Databases – Attributes & Entities Normalisation Consider this table: There are multiple entries for some of the attributes. How much space should we leave for these. These attributes are said to be “repeating groups” or non- atomic data. Lets remove them to another table. Order Number Customer ID Delivery Address Address Order Date Item Code DescOrder Quantity Unit Price BLF1Fred Bloggs 1 High Street, Any town k 01/05/091234Ring Binder Divider Stapler SMJ2Joe Smith 7, The Lane, Anytown k 03/05/099684Scissors Stapler42.99

3 WJEC Applied ICT Databases – Attributes & Entities Normalisation Table 1 in 1NF Order Number Customer ID Delivery Address Address Order Date BLF1Fred Bloggs 1 High Street, Any town k 01/05/ SMJ2Joe Smith 7, The Lane, Anytown k 03/05/09

4 WJEC Applied ICT Databases – Attributes & Entities Normalisation Table 2 in 1NF Order number and Item code make a composite key. OrderNumberItem CodeDescOrder Quantity Unit Price Ring Binder Divider Stapler Scissors Stapler42.99

5 WJEC Applied ICT Databases – Attributes & Entities Normalisation Which of these tables are NOT in first normal form?

6 WJEC Applied ICT Databases – Attributes & Entities Normalisation Moving to 2NF The item details are only dependant on the item code which is part of the key and not the OrderNumber as well. This also means we only store details of the items when we order them. To make it 2NF all the attributes must be dependant on the full key. We create another table for the items. OrderNumberItem CodeDescOrder Quantity Unit Price Ring Binder Divider Stapler Scissors Stapler42.99

7 WJEC Applied ICT Databases – Attributes & Entities Normalisation Table 1 in 2NF Order Number Customer ID Delivery Address Address Order Date BLF1Fred Bloggs 1 High Street, Any town k 01/05/ SMJ2Joe Smith 7, The Lane, Anytown k 03/05/09

8 WJEC Applied ICT Databases – Attributes & Entities Normalisation Table 2 in 2NF OrderNumberItem CodeOrder Quantity

9 WJEC Applied ICT Databases – Attributes & Entities Normalisation Table 3 in 2NF Item CodeDescUnit Price 1234Ring Binder Divider Stapler Scissors Stapler2.99

10 WJEC Applied ICT Databases – Attributes & Entities Normalisation Moving to 3NF If we go back to first table - Order Number Customer ID Delivery Address Address Order Date BLF1Fred Bloggs 1 High Street, Any town k 01/05/ SMJ2Joe Smith 7, The Lane, Anytown k 03/05/09 The primary key here is the OrderNumber. However the Delivery Address and Address is dependant on the Customer ID. So this table is not in Third Normal Form (3NF) because it fails the non- key dependance test. So we must create a new table for the customer information.

11 WJEC Applied ICT Databases – Attributes & Entities Normalisation Let us have a look at our 4 tables now in 3NF. Table : OnlineOrder Order Number Customer ID Order Date BLF101/05/ SMJ203/05/09 Table: Customer Customer ID Delivery Address Address BLF1Fred Bloggs 1 High Street, Any town T.co.uk SMJ2Joe Smith 7, The Lane, Anytown T.co.uk

12 WJEC Applied ICT Databases – Attributes & Entities Normalisation Let us have a look at our 4 tables now in 3NF. Table: ItemOrder OrderNumberItem CodeOrder Quantity Table: Item Item CodeDescUnit Price 1234Ring Binder Divider Stapler Scissors Stapler2.99

13 WJEC Applied ICT Databases – Attributes & Entities Normalisation Tasks 1)Can you write the new tables in Database notation? 2)Can you create an Entity Relationship Diagram for the new Customer Order System? 3)Have a go at the scenarios below. Can you put the following flat files into 3NF. CAR (Make, Model, Name of part, Price, Supplier name, supplier telephone number, Supplier Address)  RACES (Race name, venue, start point, end point, miles, runner name, time to finish, club name, club address, club telephone number) Runners only belong to one club.


Download ppt "WJEC Applied ICT Databases – Attributes & Entities Normalisation It is important in Database Design to make sure that the correct attributes are grouped."

Similar presentations


Ads by Google