Ham Ham’s Hammy Club
• 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
MemberID: Initial:Surname:Title:Sex:Postcode:Tel No:
Hammy Details:
Name Sex DofB Breed Origen of Breed Breed life expectancy
I’m kind of a big deal!
MemberID: 0001Initial: ASurname: DolinskiTitle: MrSex: MalePostcode: HA1 HA1Tel No: 0123456789
Hammy Details:
Name Sex DofB Breed Origen of Breed Breed life expectancy
Michelle Schuhamster
F 11.10.2007 Syrian Syria 2-3
Stormy F 26.11.2007 Syrian Syria 2-3
Minnie F 25.04.2009 Syrian Syria 2-3
Biscuit M 25.04.2009 Russian Dwarf Russia 1-2
I’m kind of a big deal!
• Hamster can have one owner• Owners can have many hamsters
HamsterHamster OwnerOwner
• A hamster can only be one breed• A breed can have many hamsters
HamsterHamster BreedBreed
HamsterHamster BreedBreed
OwnerOwner
MemberID: 0001Initial: ASurname: DolinskiTitle: MrSex: MalePostcode: HA1 HA1Tel No: 0123456789
Hammy Details:
Name Sex DofB Breed Origen of Breed Breed life expectancy
Michelle Schuhamster
F 11.10.2007 Syrian Syria 2-3
Stormy F 26.11.2007 Syrian Syria 2-3
Minnie F 25.04.2009 Syrian Syria 2-3
Biscuit M 25.04.2009 Russian Dwarf Russia 1-2
I’m kind of a big deal!
We can see we already have issues with repeated data!
MID Initial LastName
Title Sex PostCode
Tel HamName
HamSex
DOB Breed Origin LifeExp.
0001 A Dolinski Mr M HA1HA1
0123456789
Schuey F 11.10.2007
Syrian Syria 2-3
0001 A Dolinski Mr M HA1HA1
0123456789
Stormy F 26.11.2007
Syrian Syria 2-3
0001 A Dolinski Mr M HA1HA1
0123456789
Minnie F 25.04.2009
Syrian Syria 2-3
0001 A Dolinski Mr M HA1HA1
0123456789
Biscuit M 25.04.2009
R. Dwarf
Russia 1-2
0002 L Pibski Miss F FU1BA4
9876543210
Flabs M 13.05.2008
C.Dward
China 1-3
0002 L Pibski Miss F FU1BA4
9876543210
Babs F 17.02.2008
Syrian Syria 2-3
0003 S Gatti MS F QW3RT7
4651327980
Kebabs M 28.09.2007
R.Dwarf
Russia 1-2
... ... ... ... ... ... ... ... ... ... ... ... ...
... ... ... ... ... ... ... ... ... ... ... ... ...
MID Initial LastName
Title Sex PostCode
Tel HamName
HamSex
DOB Breed Origin LifeExp.
0001 A Dolinski Mr M HA1HA1
0123456789
Schuey F 11.10.2007
Syrian Syria 2-3
0001 A Dolinski Mr M HA1HA1
0123456789
Stormy F 26.11.2007
Syrian Syria 2-3
0001 A Dolinski Mr M HA1HA1
0123456789
Minnie F 25.04.2009
Syrian Syria 2-3
0001 A Dolinski Mr M HA1HA1
0123456789
Biscuit M 25.04.2009
R. Dwarf
Russia 1-2
0002 L Pibski Miss F FU1BA4
9876543210
Flabs M 13.05.2008
C.Dward
China 1-3
0002 L Pibski Miss F FU1BA4
9876543210
Babs F 17.02.2008
Syrian Syria 2-3
0003 S Gatti MS F QW3RT7
4651327980
Kebabs M 28.09.2007
R.Dwarf
Russia 1-2
... ... ... ... ... ... ... ... ... ... ... ... ...
... ... ... ... ... ... ... ... ... ... ... ... ...
Customer information is
repeated
MID Initial LastName
Title Sex PostCode
Tel HamName
HamSex
DOB Breed Origin LifeExp.
0001 A Dolinski Mr M HA1HA1
0123456789
Schuey F 11.10.2007
Syrian Syria 2-3
0001 A Dolinski Mr M HA1HA1
0123456789
Stormy F 26.11.2007
Syrian Syria 2-3
0001 A Dolinski Mr M HA1HA1
0123456789
Minnie F 25.04.2009
Syrian Syria 2-3
0001 A Dolinski Mr M HA1HA1
0123456789
Biscuit M 25.04.2009
R. Dwarf
Russia 1-2
0002 L Pibski Miss F FU1BA4
9876543210
Flabs M 13.05.2008
C.Dward
China 1-3
0002 L Pibski Miss F FU1BA4
9876543210
Babs F 17.02.2008
Syrian Syria 2-3
0003 S Gatti MS F QW3RT7
4651327980
Kebabs M 28.09.2007
R.Dwarf
Russia 1-2
... ... ... ... ... ... ... ... ... ... ... ... ...
... ... ... ... ... ... ... ... ... ... ... ... ...
Breed information is repeated
In some cases, you may need to add a new field to make a compound primary key.
In some cases, you may need to add a new field to make a compound primary key.
This fixes the many-to-many problem!This fixes the many-to-many problem!
Here we have a foreign key – a non-primary key that links to a primary key in another table.
Here we have a foreign key – a non-primary key that links to a primary key in another table.
• 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.