You are on page 1of 26

Normalisation

Un-normalised form

Write down every data object in the given source materials.

Like this
event_no event_name position competitor performance

competitor_name
school_name school_address1 school_address2

Pick a Primary Key

Qu1- Whats this all about?

Decide

what the data is all about and underline that data item There may be more than one obvious choice - pick any one! (unlikely in exam?)

Like this
event_no event_name position

competitor_no
school_name school_address1 school_address2

competitor-_no
performance competitor_name school_name

event_no

or

event_name position competitor_name

school_address1
school_address2

performance

Identify repeating groups Qu 2 - How many?

For each <primary key> is there one or more than one of each of the other data items?

In this case
For each event number is there one or more than one event name? For each event number is there one or more than one competitor name For each event number is there one or more than one school name Write 1 or M beside each data item

Like this
event_no event_name position 1 M

competitor_no
school_name school_address1 1 1 1

competitor_no
performance competitor_name school_name M

M
M M

school_address2

or

competitor_name 1 event_no M event_name position performance M M M

school_address1
school_address2

M
M

To make it look pretty put brackets round all the Ms..


event_no event_name (position

competitor_no
performance competitor_name school_name

This is the repeating group

school_address1
school_address2 )

Write the repeating group as a new table Take a copy of the primary key with it
event_no event_name

position competitor_no performance competitor_name school_name school_address1 school_address2 event_no

Decide on a primary key for the new table


position competitor_no performance competitor_name school_name school_address1 school_address2 event_no

Tidy things up

Write the primary keys at the top of the table Mark the copy of the original key as a foreign key
event_no competitor_no* event_name position performance

competitor_no event_no* position performance competitor_name school_name school_address1 school_address2

or

1st Normal Form


event_no event_name competitor_no competitor_name school_name school_address1

competitor_no
event_no* position performance

or

school_address2

event_no competitor_no* event_name position performance

competitor_name
school_name school_address1 school_address2

Remove partial dependencies

How?

Examine table with more than 1 key Draw a grid

Number of rows = number of data items

competitor_no + event_no + position + performance + competitor_name + school_name + school_address1 + school_address2 = 8

Number of columns = number of keys +2

competitor_no + event_no + 2 = 4

Insert data item names in first column


comp_no event_no position performance

comp_name sch_name
sch_add1 sch_add2

Fill the second column with some supplied data


comp_no event_no position 110 10 1

performance 16.7
comp_name June Day sch_name Clifford High sch_add1 Clifford Rd

sch_add2

Inverdon

Qu3 What can be different?


Change one key and fill in data in third column Mark data which may change

Circle, underline, different colour

Like this
comp_no event_no position 110 10 1 112 10 4

performance 16.7
comp_name June Day sch_name sch_add1 sch_add2

17.4
Yvonne Knowles

Clifford High Westlake High Clifford Rd West Rd Inverdon Waterdon

Repeat for next column changing a different key


comp_no event_no 110 10 112 10 110 12

position 1 performance 16.7 comp_name June Day


sch_name sch_add1

sch_add2

4 17.4 Yvonne Knowles Clifford High Westlake High Clifford Rd West Rd Inverdon Waterdon

3 102 June Day


Clifford High Clifford Rd

Inverdon

Remove all data items marked in both (all) columns along with copies of the keys
competitor_no* event_no*

position performance

Mark the keys as foreign keys

Write the remaining data items in new list(s) along with marked key in that column
competitor_no competitor_name school_name school_address1

school_address2

2nd Normal Form


event_no event_name
Yes there is only one

Check each table to make sure the key determines all the data items

competitor_no*
event_no* position performance competitor_no competitor_name school_name school_address1 school_address2
Better have a closer look at this one!! Yes we know from our previous table

Qu4 Does this data describe the key?


competitor_no competitor_name

- yes, it tells us about the competitor

school_name attends school_address1 no, it tells us about the school school_address2


no, it tells us about the school

yes, it tells us which school the competitor

Move to 3NF

Remove non-descriptive items to a new table with the item they describe. Leave a copy of this item as a foreign key

Like this
competitor_no competitor_name school_name* school_name school_address1 school_address2

3NF
event_no event_name competitor_no*

event_no*
position performance competitor_no

competitor_name
school_name* school_name school_address1 school_address2

You might also like