Download presentation
Presentation is loading. Please wait.
1
Normalisation Ham Ham’s Hammy Club
2
Introduction What is normalisation?
“a technique for designing relational database tables to minimize duplication of information and, in so doing, to safeguard the database against certain types of logical or structural problems” wikipedia.com
3
Ham Ham’s Hammy Club – Customer Record
MemberID: Initial: Surname: Title: Sex: Postcode: Tel No: Hammy Details: I’m kind of a big deal! Name Sex DofB Breed Origen of Breed Breed life expectancy
4
Ham Ham’s Hammy Club – Customer Record
MemberID: 0001 Initial: A Surname: Dolinski Title: Mr Sex: Male Postcode: HA1 HA1 Tel No: Hammy Details: I’m kind of a big deal! Name Sex DofB Breed Origen of Breed Breed life expectancy Michelle Schuhamster F Syrian Syria 2-3 Stormy Minnie Biscuit M Russian Dwarf Russia 1-2
5
Relationships Hamster can have one owner Owners can have many hamsters
6
Relationships A hamster can only be one breed
A breed can have many hamsters Hamster Breed
7
Relationships Owner Hamster Breed
8
Ham Ham’s Hammy Club – Customer Record
MemberID: 0001 Initial: A Surname: Dolinski Title: Mr Sex: Male Postcode: HA1 HA1 Tel No: Hammy Details: I’m kind of a big deal! Name Sex DofB Breed Origen of Breed Breed life expectancy Michelle Schuhamster F Syrian Syria 2-3 Stormy Minnie Biscuit M Russian Dwarf Russia 1-2 We can see we already have issues with repeated data!
9
Example Data 11.10.2007 26.11.2007 25.04.2009 MID Initial Last Name
Title Sex Post Code Tel Ham DOB Breed Origin Life Exp. 0001 A Dolinski Mr M HA1 Schuey F Syrian Syria 2-3 Stormy Minnie Biscuit R. Dwarf Russia 1-2 0002 L Pibski Miss FU1 BA4 Flabs C. Dward China 1-3 Babs 0003 S Gatti MS QW3 RT7 Kebabs R. Dwarf ...
10
Customer information is repeated
Example Data MID Initial Last Name Title Sex Post Code Tel Ham DOB Breed Origin Life Exp. 0001 A Dolinski Mr M HA1 Schuey F Syrian Syria 2-3 Stormy Minnie Biscuit R. Dwarf Russia 1-2 0002 L Pibski Miss FU1 BA4 Flabs C. Dward China 1-3 Babs 0003 S Gatti MS QW3 RT7 Kebabs R. Dwarf ... Customer information is repeated
11
Breed information is repeated
Example Data MID Initial Last Name Title Sex Post Code Tel Ham DOB Breed Origin Life Exp. 0001 A Dolinski Mr M HA1 Schuey F Syrian Syria 2-3 Stormy Minnie Biscuit R. Dwarf Russia 1-2 0002 L Pibski Miss FU1 BA4 Flabs C. Dward China 1-3 Babs 0003 S Gatti MS QW3 RT7 Kebabs R. Dwarf ... Breed information is repeated
12
Normalisation Rules 1NF 2NF 3NF
No repeating attributes and primary key of non repeating data must be placed in table of repeating data. 2NF Look for non-key attributes that depend upon all the attributes in the compound primary keys i.e. does the attribute depend on both primary keys? 3NF Look for non-key attributes that depend upon other non-key attributes.
13
Normalisation Table UNF 1NF 2NF 3NF Name
14
UNF – List out all fields
Name MemberID Initial LastName Title Sex PostCode Tel HamName HamSex DOB Breed Origin LifeExpectancy
15
1nf – Apply Rules UNF 1NF 2NF 3NF Name MemberID Initial LastName Title Sex PostCode Tel HamName HamSex DOB Breed Origin LifeExpectancy HamID In some cases, you may need to add a new field to make a compound primary key.
16
2nf – Apply Rules This fixes the many-to-many problem! UNF 1NF 2NF 3NF
Name MemberID Initial LastName Title Sex PostCode Tel HamName HamSex DOB Breed Origin LifeExpectancy HamID This fixes the many-to-many problem!
17
3nf – Apply Rules UNF 1NF 2NF 3NF Name MemberID Initial LastName Title Sex PostCode Tel HamName HamSex DOB Breed Origin LifeExpectancy HamID Breed* Member Ownage Hammy Here we have a foreign key – a non-primary key that links to a primary key in another table.
18
Normalised table! UNF 1NF 2NF 3NF Name MemberID Initial LastName Title
Sex PostCode Tel HamName HamSex DOB Breed Origin LifeExpectancy HamID Breed* Member Ownage Hammy
19
Remember!! You don’t actually need to know how to normalise a database. It’s useful to know though because you’ll have a better understanding of it – it’ll also help in coursework! However, you need to know the advantages of doing so and you’ll need to know the rules.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.