0% found this document useful (0 votes)
6 views16 pages

Normalisation 3NF

The document discusses the process of normalizing a database to First Normal Form (1NF), Second Normal Form (2NF), and Third Normal Form (3NF). It outlines the issues of non-1NF tables, the benefits of normalization, and the steps required to achieve each normal form while ensuring data integrity and reducing redundancy. The document includes examples of how to structure student, course, and lecturer data in a normalized database format.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views16 pages

Normalisation 3NF

The document discusses the process of normalizing a database to First Normal Form (1NF), Second Normal Form (2NF), and Third Normal Form (3NF). It outlines the issues of non-1NF tables, the benefits of normalization, and the steps required to achieve each normal form while ensuring data integrity and reducing redundancy. The document includes examples of how to structure student, course, and lecturer data in a normalized database format.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

First Normal

Form (1 NF)
Original Table – Non-1NF
Name Date of Birth Gender Course Details Lecturer
Details
Rishi 22/05/2007 M C123, Computer Science, DIP, Bhatt, HUP,
A007, Accounting, M692, Patel, RAH, Hunt
Math
Gurjant 16/11/2006 M C123, Computer Science, DIP, Bhatt, RAH,
M692, Math, B873, Hunt, ABS, Sattar
Business
Janu 06/06/2007 F C123, Computer Science, DIP, Bhatt, NAJ,
I648, IT, B873, Business Jamal, ABS,
Sattar
Ozzy 11/02/2007 M C123, Computer Science, DIP, Bhatt, NAJ,
I648, IT, S749, Sociology Jamal, SHI, Ismail
Demi 30/05/2007 M C123, Computer Science, DIP, Bhatt, HHL,
E470, English Language, Hurdley-Lees,
M692, Math RAH, Hunt
Priya 21/12/2006 F C123, Computer Science, DIP, Bhatt, ARK,
P439, Psychology, M693, Khan, RAH, Hunt
01 02 03
Cells contain multiple values Repeating groups (e.g.
1 NF requires atomic values
(e.g. multiple courses or course and lecturer details
and no repeating groups
lecturers per student) grouped together)

Identifying Non-1NF
Issues
Step one:
Separate each value into individual
rows Gend Course Course Lecture Lecturer
Name Date of
Birth er Numbe Name r Initial Name
r • Splitting rows
Rishi 22/05/200 M C123 Computer DIP Bhatt
7 Science
to ensure
Rishi 22/05/200 M A007 Accounting HUP Patel each cell has
7 only one
Rishi 22/05/200 M M692 Math RAH Hunt value per
7
student-
Gurja 16/11/200 M C123 Computer DIP Bhatt
nt 6 Science course-
Gurja 16/11/200 M B873 Business ABS Sattar lecturer
nt 6 combination
Gurja 16/11/200 M M692 Math RAH Hunt
nt 6
Benefits of 1 NF
• Simplifies data retrieval
• Reduces redundancy
• Ensures consistency
Second Normal
Form (2 NF)
• To get to the second normal form (2NF), a table should follow two
rules
- The data is already in 1NF
- Any partial dependencies have been removed. This mean that
every non-key attribute depends on the whole primary key and not
just a part of it
- But since our data is already in 1NF we don’t have to worry about
removing and partial dependencies
- Every other field depends on one field which is called dependency
• now we split that table up and create relationships between them
and they can’t be M:M
STUDENT(Name, Date of birth, Gender, Course number, Course name, Lecturer initial,
Lecturer name)

Name Date of Gender Course Course Name Lecturer Lecturer


Birth Number Initial Name
Rishi 22/05/2007 M C123 Computer DIP Bhatt
Science
Rishi 22/05/2007 M A007 Accounting HUP Patel
Rishi 22/05/2007 M M692 Math RAH Hunt
Gurjant 16/11/2006 M C123 Computer DIP Bhatt
Science
Gurjant 16/11/2006 M B873 Business ABS Sattar
Gurjant 16/11/2006 M M692 Math RAH Hunt
Janu 06/06/2007 F C123 Computer DIP Bhatt
Science
Janu 06/06/2007 F I648 IT NAJ Jamal
Name Date of Gender Course Cours Course Name Lecturer Lectur
Birth Number e Initial er
Rishi 22/05/2007 M C123 Numb Name
er
Rishi 22/05/2007 M A007 C123 Computer DIP Bhatt
Science
Rishi 22/05/2007 M M692
A007 Accounting HUP Patel
Gurjant 16/11/2006 M C123
M692 Math RAH Hunt
Gurjant 16/11/2006 M B873
B873 Business ABS Sattar
Gurjant 16/11/2006 M M692
I648 IT NAJ Jamal
Janu 06/06/2007 F C123
S749 Sociology SHI Ismail
Janu 06/06/2007 F I648 E470 English HHL Hurdely
Literature -Lees
STUDENT (Name, Date of Birth, Gender, Course COURSE
P439 (Course Number, Course
Psychology ARK Name, Khan
Number) Lecturer Initial, Lecturer Name)

Student Student
M:M
2NF
• Now we have created a M:M relationship table.
• The table would be a lot longer as each student takes
more than 1 course and that would lead to a lot of
repeating data. So, we would create a neat primary key
like student number.
• Fixing M:M relationship is easy
• We can fix this by creating a new table.
• This new table will be made by assigning the primary
keys from the two tables we already have as a
composite key for the new table.
• And now make two 1:M relationship
Stude Name Date Gende Studen Course Course Course Lectur Lecture
nt of r t Numbe Numbe Name er r Name
Numb Birth Numbe r r Initial
er r
001 Rishi 22/05/ M 001 C123 C123 Computer DIP Bhatt
2007 Science
002 Gurjan 16/11/ M 001 A007 A007 Accountin HUP Patel
t 2006 g
003 Janu 06/06/ F 001 M692 M692 Math RAH Hunt
2007
004 Ozzy 11/02/ M 002 C123 C123 Computer DIP Bhatt
2007 Science
005 Demi 30/05/ M 002 B873 B873 Business ABS Sattar
2007
006 Priya 21/12/ F 002 M692 M692 Math RAH Hunt
2006
STUDENT ( Student Number, Student_COURSE COURSE (Course Number, Course Name,
Name, Date of Birth, Gender) (Student Lecturer Initial, Lecturer Name)
Number, Course
Student_
Number) Student Course
Course
Third Normal
Form (3 NF)
• For third normal form (3NF) there are two rules to follow
• Data should already be in 2NF
• Any transitive dependencies should be removed – meaning any
non-key dependency in one where the value of a field is
determined by the value of another field that’s not part of the
primary key
• A way to help ensure the table is in 3 NF is through the
phrase:
• ‘All fields are dependent on the key, the whole key and nothing
but the key’
• 3 NF aims to remove any further repeating data
Stude Name Date Gende Studen Course Course Course Lectur Lecture
nt of r t Numbe Numbe Name er r Name
Numb Birth Numbe r r Initial
er r
001 Rishi 22/05/ M 001 C123 C123 Computer DIP Bhatt
2007 Science
002 Gurjan 16/11/ M 001 A007 A007 Accountin HUP Patel
t 2006 g
003 Janu 06/06/ F 001 M692 M692 Math RAH Hunt
2007
004 Ozzy 11/02/ M 002 C123 C123 Computer DIP Bhatt
2007 Science
005 Demi 30/05/ M 002 B873 B873 Business ABS Sattar
2007
006 Priya 21/12/ F 002 M692 M692 Math RAH Hunt
2006
3 NF
• Now that the transitive dependencies have been
identified (lecturer initials and lecturer name)
• Split the table apart to prevent any further redundancy
and dependency
• Determine the relationship of the new table – in our
scenario (1:1)
• Lecturer initials becomes the new primary key for the
new table called lecturer
Stude Name Date Gende Stude Course Course Course Lecturer Lectur Lectur
nt of r nt Numb number name initial er er
Numb birth Numb er initial name
er er C123 Compute DIP DIP Bhatt
r science
001 Rishi 22/05/ M 001 C123
2007 A007 Accountin HUP
HUP Patel
002 Gurjan 16/11/ M 001 A007 g
t 2006 M692 Math RAH RAH Hunt
003 Janu 06/06/ F 001 M692 ABS Sattar
B873 Business ABS
2007
004 Ozzy 11/02/ M 002 C123 I648 IT NAJ NAJ Jamal
2007
002 M692
005 Demi 30/05/ M S749 Sociology SHI SHI Ismail
2005
E470 English HHL HHL Hurdely
006 Priya 21/12/ F 002 B873 Literature -Lees
2006
P439 Psycholo ARK ARK Khan
003 C123 gy number, Course
STUDENT (Student Number, Name, STUDENT_COURSE COURSE (Course Lecturer (Lecturer
Date of birth, Gender) (Student number, name, Lecturer initial) initial, Lecturer name)
Course number)

Studen Student Lecture


course Course
t r

You might also like