1 NORMALISATION. 2 Introduction Overview Objectives Intro. to Subject Why we normalise 1, 2 & 3 NF...
-
date post
21-Dec-2015 -
Category
Documents
-
view
218 -
download
0
Transcript of 1 NORMALISATION. 2 Introduction Overview Objectives Intro. to Subject Why we normalise 1, 2 & 3 NF...
2
Introduction
• Overview
• Objectives
• Intro. to Subject
• Why we normalise
• 1, 2 & 3 NF
• Normalisation Process
• Example
• Summary
3
Overview
The development of the application (creating an Access database) is usually one of the easiest steps in the process.
Correct design of the database is one of the hardest steps but is of the utmost importance. In this lecture we concentrate upon this.
4
Objectives
By the end of this lecture the student should:
• Appreciate the need for normalisation
• Understand what is meant by 1st, 2nd & 3rd Normal Form
• Be able to perform simple normalisation
5
Intro. to Subject
• DFD’s provide data flow info and process modelling
• ERM provides entities & attributes (top down modelling)
• Normalisation is designing a robust DB (bottom up modelling)
6
Why Normalise ?
• Data Modelling captures the data a system needs to store
• Normalisation has two main objectives:
ID of entities
Logical model
7
How it links to Access
• All data of interest to system belongs in one database
• Each entity is an Access table
• Each attribute is an Access field
• Using Normalisation you will identify the primary key
8
Normalisation
• Normalisation is an algorithm for reducing complex data structures to simple structures
• Also known as Codd’s or Boyce Codd’s law
9
Normalisation
• Data that is not normalised can create insert/update/delete anomalies.
• Minimise Data Redundancy
• Achieve logical data grouping
• Will not ensure that we have captured all the data
10
First Normal Form (1NF)
• Definition: An entity is in First Normal Form if it has an identifying key and there are no repeating attributes or groups of attributes
11
First Normal Form (1NF)
To remove repeating groups:
• *Leave non-repeating attributes alone ( 1NF entity)
• *Remove repeating attributes to separate 1NF entity whose key will be original key + key to repeating group
12
Second Normal Form (2NF)
Definition: An entity is in 2NF if
it is in first normal form and has
no attributes which require only
part of the key to identify them
uniquely.
13
Second Normal Form (2NF)
• To remove part-key dependencies
• check that each non -key attribute depends on the whole key to determine it.
• for each subset of a key, create a new separate entity
14
Third Normal Form (3NF)
Definition: An entity is in 3NF if
and only if it is in 2NF and no
non-key attribute depends on any
other non-key
15
Keys
A Simple key is the unique identifier.
A Compound key is made up of two or more simple keys. This creates the link between the two entities.
A Foreign key is a non-key attribute in one entity which is a key attribute in another.
16
ExampleFor example a school has fourfloors and on each floor there are rooms one to twenty. Floor and room repeat; to identify a singleroom we use:
(Floor Number)(Room Number)
The brackets mean that the lowerlevel non-unique identifier roomnumber must have the higher level unique identifier to make thewhole key unique.
17
ExampleCourse Registration Record
Course Record
Course Code: FR001
Course
Description: Beginning French
E-No Name Hours Room Tel-No166 Bain G 24 118 2783174 Thol H 12 203 2834449 Adam I 36 306 2844213 Jones A 24 118 2783
21
Example
3NF
Course Code
Course Descr
Course Code
E-No
Hours
E-No
Name
Room*
Room
Tel-No
Thus we have identified FOUR entities:
Course, Employee-on-Course, Employee & Room