0% found this document useful (0 votes)
2 views

NoteGPT_Database Normalisation_ Second Normal Form

The video explains database normalization, focusing on achieving second normal form (2NF) from first normal form (1NF). It emphasizes that a table in 2NF must not have partial dependencies, meaning each non-key field must relate directly to the primary key and each table should represent only one type of entity. The video illustrates this by demonstrating how to separate student and course data into distinct tables to eliminate redundancy and maintain data integrity.

Uploaded by

JOHN VANDER
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

NoteGPT_Database Normalisation_ Second Normal Form

The video explains database normalization, focusing on achieving second normal form (2NF) from first normal form (1NF). It emphasizes that a table in 2NF must not have partial dependencies, meaning each non-key field must relate directly to the primary key and each table should represent only one type of entity. The video illustrates this by demonstrating how to separate student and course data into distinct tables to eliminate redundancy and maintain data integrity.

Uploaded by

JOHN VANDER
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

this video is about database normalization specifically normalizing a

database to a second normal form it follows on from the video about first normal
form by working through the same example the technical definition of second normal
form states that the data must be in first normal form and a relation must not
contain any partial dependencies what this means is that the data must be in first
normal form and each non key field must be about the same thing as the primary key
also each table must contain data about only one

type of thing this table is in first normal form well debatably let's
remove any argument by separating the first-name and lastname into separate columns
so now the first condition for second normal form is satisfied that is the table is
already in first normal form although it's not necessary for second normal form
let's also clean up the data a little let's give David a last name and let's
suppose there is only one moving Drake after all you can see that there's still an
issue with redundant data here for

every course a student does the students details are duplicated this is a
big clue that the table is not yet in second normal form is that a problem well it
could become one imagine there were thousands of records there'd be even more
duplication and imagine one of the students got married and you wanted to update
their marital status you'd need to make exactly the same change in several places
this is how inconsistency errors can start to creep in let's add some more columns
to exaggerate the problem there's more information about

each course now which means more duplication and there's also the grade
that each student achieved when they completed a course by definition to be in
second normal form a relation in other a table must not have any attributes that
are partially dependent on the primary key a much simpler way of saying that is a
table should only contain data about one type of thing or to be slightly more
technical a table should only contain data about one type of entity if it's about
more than one type of entity the data need to be split into

separate tables so what's this table about what things does it describe
for a start it contains various data which are just about students an ID first name
last name and marital status when you examine the data you can see that the ID is
unique for each student and that the first name last name and marital status are
each about the same thing that the ID is about this table uses a simple sequential
number for each ID but it could have used something more personal like a Student
Union number or a

National Insurance number something that will always belong to a


particular student on that basis if you change the ID then the record is all about
a different student so you need to change the first name last name and marital
status as well when you have to change one thing because you've changed another
this is known as a functional dependency the first name last name and marital
status are functionally dependent on the ID and it's the only thing that they are
functionally dependent on the table also

contains various data just about courses the course title fee and
qualification examine the data and you can see that the course title is unique for
each course the fee and qualification are both about the same thing as the course
title change the course title for a course and it becomes a different course so you
need to change the fee and the qualification as well they are functionally
dependent on the course title and it's the only thing that they function be
dependent on and finally and this

might not be immediately obvious this table also contains data about each
student and course combination look at the grade column each student has a grade
for each course they attended Kevin drum for example did three courses so he has
three separate grades each of Kevin's grades is not just about Kevin it's also
about the course he did to achieve that grade each grade is partially dependent on
the student and partially dependent on the course now consider this tables primary
key for a moment at first sight it might not

appear to have a primary key at all the ID column is unique for each
student but it's not unique for each record so by definition the ID column is not
the primary key of this table the course title column is unique for each course but
it's not unique for each record so it can't be the primary key of this table
however the combination of ID and course title is unique for each record together
these two fields serve as a composite primary key the primary key for each record
in this table contains a

piece of information about a student and a piece of information about a


course in fact it tells you which students are doing which courses and you need to
retain this information so here are the three tables you're going to need the
students table only contains data about students each student occurs only once in
the students table and each student record has a unique ID the unique ID is the
primary key and in this table each ID is only about a student every other attribute
in the students table is only

about a student to put that in technical jargon every non-key attribute


is functionally dependent on the primary key and only the primary key there are no
partial dependencies the courses table only contains data about courses each course
only occurs once in the courses table and each course has a unique course title the
course title is the primary key in this table and it's only about a course every
non-key attributes in the courses table is also only about a course in other words
every non-key attributes of the courses table

is functionally dependent on the primary key and only the primary key
there are no partial dependencies the student course table is about which students
enrolled on which courses and how well each student performed it only contains
information about each student course combination the combination of ID and course
title is unique in the student course table so this table has a composite primary
key every non-key attributes in this table namely the grade is about the student
course combination the grade is functionally

dependent on the primary key and only the primary key there are no
partial dependencies here all of these tables are now in second normal form the
student course table is sometimes called a bridging table or a linked entity
because it serves to join the three tables together overall there are fewer
individual data items being stored than when there was a single table in first
normal form the database is now more space efficient and this efficiency will
become even more significant as the number of students and courses grows not

only that but if it becomes necessary to change something like a


student's marital status or the fee for a course or a grade this only needs to be
changed in one place so there's less chance of inconsistent data to summarize in
technical terms in order for a table to be in second normal form the data must
already be in first normal form and a relation must not contain any partial
dependencies in simpler terms the data must be in first normal form each non key
field must be about the same thing as the primary key

each table must contain data about only one type of thing only one type
of entity you can see how important it is to know what the data means in order to
make these decisions

You might also like