Case of Normalisation
Case of Normalisation
Case of Normalisation
Experiment No. 2
Aim: Case Study of Normalisation.
Normal forms are use to decompose our table in such form which prevent our database
to suffer from various type of anomalies as we discussed before.
First normal form:- A relation is said to be in 1NF when its all relations are atomic
or simple. It should not be a set of value related to the attribute.
Table 1 Table 2
Here Atomicity is not present because we are having a group of value in courses
attribute which is related to branch. To make it in 1NF –
__________________________________________________________________________
1: Is in 1NF. All its primary attributes are fully functional dependent on the key attribute
for making it in 2NF, Decompose table in two part, one is having key attribute and the
other attribute which already in functional dependency, Here (Employee Skill) –>
Current Works Location Employee –> Current works location (fails here).So, we make
two table which describe the above rule to decompose in 2NF.
3
CGC-COE RDBMS II LAB
1- It is in 2NF.
2- All non primary attribute have no transitive dependency on key attribute.
Here ROLL –> GAME –> FEE (Transitive dependency occurs)–> ROLL (So it is in 2NF)
Because of transitive dependency we will get: Insert anomaly, Deletion and Updation
anomaly as well.
1: Divide the table on the base of attributes where we are getting Transitive Dep.
2: In one relation put attribute which are fully functional dependent.
Games Roll
Cricket 1
Tennis 2
Football 3
Cricket 4
Hockey 5
Games Fee
Cricket 200
Tennis 300
Football 100
Hockey 150
4
CGC-COE RDBMS II LAB
A BCNF relation is always be in 3NF but, 3NF relation will may be in BCNF.
Decomposition :-
____________________________________________________________________________
1: It is in BCNF.
2: There is no multivalued dependency in the relation.
MVD occurs when two or more independent multi valued attributes are about the same
attribute occur within same table. As R –> –> B.
Here both the empid is having more than one skill or language known. so
EMPID –> –> LANG
EMPID –> –> SKILLS
So, if 101 stops teaching in hindi then we have to delete 1 more row ( eng, teach).
Make 2 relation to decompose the above relation in two part :-
1: EMP1 (EMPID,LANG)
2: EMP2 (EMPID,SKILLS)
5
CGC-COE RDBMS II LAB
EMPID LANG
101 ENG
101 HIN
202 ENG
202 HIN
EMPID SKILLS
101 TEACH
101 CONVER
202 SING
202 CONVER
__________________________________________________________________
Fifth normal form (5nf):- A database is said to be in 5NF, if and only if,
It's in 4NF
If we can decompose table further to eliminate redundancy and anomaly, and
when we re-join the decomposed tables by means of candidate keys, we should
not be losing the original data or any new record set should not arise. In simple
words, joining two or more decomposed table should not lose records nor create
new records.
Consider an example of different Subjects taught by different lecturers and the lecturers
taking classes for different semesters.
This table lists agents, the companies they work for and the products they sell for those
companies. 'The agents do not necessarily sell all the products supplied by the
companies they do business with. An example of this table might be:
6
CGC-COE RDBMS II LAB
The table is necessary in order to show all the information required. Suneet , for
example, sells ABC's Nuts and Screws, but not ABC's Bolts. Raj is not an age it for CDE
and does not sell ABC's Nuts or Screws. Suppose that the table is decomposed into its
two projections, PI and P2.