SlideShare a Scribd company logo
Data Normalization
OBJECTIVES
 To understand about the functional dependencies.
 To bring out solution of Trivial , non-trivial , full dependency and
transitive.
 To known about the Armstrong inferences rules.
 To understand about data normalization.
Functional Dependencies
1. It is important role play to design a good or bad database.
2. Basically functional dependencies is a type of constraints that is a generalization
in the notation of key.
3. Functional Dependency (FD) determines the relation of one attribute to another
attribute in a database management system (DBMS) system.
4. Functional dependency in DBMS, as the name suggests is a relationship
between attributes of a table dependent on each other. Introduced by E. F.
Codd, it helps in preventing data redundancy and gets to know about bad
designs.
5. It is represented by -> (arrow) sign. Ex- P -> Q.
6. It is a set of legal relation. Its depicts relationship of attributes.
7. For any relation r containing attributes P and Q and if for every valid instance of
P determines uniquely value of Q It is expressed as:
 P -> Q
 P determines Q
 Q dependent P or Q is determines by P
Let f: P -> Q Relation so that P -> compute the value of Q.
Fig1. Fig2.
 P & Q in set of attributes.
 This is the value which is store in P & Q. here we see that value is not duplicate in both row,
 In this fig1. we easily search any value of P. suppose if you want to search the value of a1 so you can easily
find the value of a1.
 In this fig2. we don’t say what is the actual value of a1. so that
F(P) - Q
a1  10
a1  20
b1  10
Here we see this example. It is possible to meet same value of dependent but not possible determines is same.
P Q
a1 10
b1 20
c1 30
d1 40
P Q
a1 10
a1 20
c1 30
d1 40
It is a relationship that exists when one attributes uniquely determines another attributes.
 If R is relation with all P & Q
Uniquely Determination P -> Q
Q is functional dependency on P
-> It is a set of constrains between 2 attributes in a relations.
Q is functional dependent on P
Identification key P -> Q
Eg: if every attribute Q of R dependent of P then attributes P is primary key.
In this table SSN -> FNAME
SSN -> LNAME
So it dependent of a particular table.
SSN Fname Lname
101 Ravi Kumar
102 Piyush Tiwari
103 Kartik Mishra
104 Harish Prasad
Fully Functional Dependency:
ABC - D
1. D is fully functional dependent on ABC
2. D cannot dependent on any subset of ABC
BC -> D
C -> D
A -> D
This is not possible because BC cannot determine D , C cannot determine D and A cannot
determine D.
In ABC -> D , only D is fully functional dependence of ABC.
Sid sname tid smarks
101 Ravi 201 34
102 Piyush 202 44
103 Kartik 203 55
104 Harish 204 33
Here in this table sid,tid  Identification Key
so that marks is fully dependent of sid & Pid. This is combination of two attributes full functionally
dependent.
Transitive Dependency:
Consider attributes PQ & R
When P -> Q & Q -> R
If full dependency one transitive also have the
FD : A -> C
C is transitive dependent on P through Q. Here we consider two tables Employee & Department.
Eno -> Dno P-> Q
P Q Q R
Same as Eno -> email P -> Q
Eno -> dno , dno -> dname , eno  dname so that P -> Q , Q -> R so that P -> R This is
transitive dependency.
Eno Email Dno Dname
Trivial function dependency :
Trivial dependency is a set of attributes which are called a trivial if the set of attributes are
included in that attributes.
So that P -> Q is a trivial if Q is subset of P.
Ex-: [sid , sname]  sid is a trivial dependency as sid is a subset of [sid,sname].
Non - Trivial function dependency : In this dependency which also known non-trivial occurs
when P -> Q holds true where Q is not subset of P. In attributes Q is not subset of P.
Sid -> sname or P -> Q and sname -> sdob Q -> R
Sid sname
101 Ravi
102 Piyush
103 Kartik
104 Harish
Sid sname sdob
101 Ravi 1
102 Piyush 2
103 Kartik 3
104 Harish 4
Armstrong Inferences Rules:
The term Armstrong axioms to the sound and complete set of inference rules or
axioms, introduced by William W. Armstrong, that is used to test the logical
implication of functional dependencies. If F is a set of functional dependencies
then the closure of F, denoted as F plus, is the set of all functional dependencies
logically implied by F. Armstrong’s Axioms are a set of rules, that when applied
repeatedly, generates a closure of functional dependencies.
 It is a basic rule.
 It are used to conclude functional dependencies on a relational database.
 The inference rule is a type of assertion. It can apply to a set of FD(functional
dependency) to derive other FD.
 By using of this , we can derive additional functional dependency from the
initial set.
Data normalization
1. Reflexive Rule
according to reflexive rule, if B is a subset of A, then A determines B.
If A ⊇ B then A → B eid - > eid
A = {eid,ename,eage}
B = {eid,ename}
2. Augmentation Rule
The augmentation is also called as a partial dependency. In augmentation, if A
determines B, then AC determines BC for any C.
If A → B then AC → BC
Example:
For R(ABC), if A → B then AC → BC
3. Transitive Rule
In the transitive rule, if A determines B and B determine C, then A must also determine
C.
If A → B and B → C then A → C
4. Union Rule
Union rule says, if A determines B and A determines C, then A must also determine B
and C.
If A → B and A → C then A → BC
1. A → B (given)
2. A → C (given)
3. A → AB (using 2 rules on 1 by augmentation with A. Where AA = A)
4. AB → BC (using 2 rules on 2 by augmentation with B)
5. A → BC (using 3 rules on 3 and 4)
5. Decomposition Rule
Decomposition rule is also known as project rule. It is the reverse of union rule.
This Rule says, if A determines B and C, then A determines B and A determines C
separately.
If A → BC then A → B and A → C
1. A → BC (given)
2. BC → B (using rule 1)
3. A → B (using rule 3 on 1 and 2)
6. Pseudo transitive Rule
If A holds B and BC holds D, then AC holds D.
If {A → B} and {BC → D}, then {AC → D}
1. A → B (given)
2. DB → C (given)
3. DA → DB (By using 2 rule on 1 by augmenting with D)
4. DA → C (by using 3 rule on 3 and 2)
Example:
Consider relation E = (P, Q, R, S, T, U) having set of Functional Dependencies (FD).
P -> Q P -> R
QR -> S Q -> T
QR -> U PR -> U
Calculate some members of Axioms are as follows,
1. P -> T
2. PR -> S
3. QR -> SU
4. PR -> SU
Solution:
1. P -> T
In the above FD set, P -> Q and Q -> T
So, Using Transitive Rule: If {P -> Q} and {Q -> T}, then {P -> T}
? If P -> Q and Q -> T, then P -> T.
P -> T
2. PR -> S
In the above FD set, P -> Q
As, QR -> S
So, Using Pseudo Transitivity Rule: If{A -> B} and {BC -> D}, then {AC -> D}
If P -> Q and QR -> S, then PR -> S.
PR -> S
3. QR -> SU
In above FD set, QR -> S and QR -> U
So, Using Union Rule:
If{A -> B} and {A -> C}, then {A -> BC}
If QR -> S and QR -> U, then QR -> SU.
QR -> SU
4. PR -> SU
So, Using Pseudo Transitivity Rule:
If{A -> B} and {BC -> D}, then {AC -> D}
If PR -> S and PR -> U, then PR -> SU.
PR -> SU
Data normalization
Data normalization
Data normalization
Data normalization
Data normalization
Data normalization
Data normalization
Data normalization
Data normalization
Data normalization
Data normalization
Data normalization
Data normalization
Data normalization
Data Normalization
Database Normalization is a technique of organizing the data in the database.
Normalization is a systematic approach of decomposing tables to eliminate data
redundancy(repetition) and undesirable characteristics like Insertion, Update and Deletion
Anomalies. It is a multi-step process that puts data into tabular form, removing duplicated
data from the relation tables.
 Normalization is used for mainly two purposes,
 Eliminating redundant(useless) data.
 Ensuring data dependencies make sense i.e. data is logically stored.
Problems Without Normalization
If a table is not properly normalized and have data redundancy then it will not only eat up
extra memory space but will also make it difficult to handle and update the database,
without facing data loss. Insertion, Updating and Deletion Anomalies are very frequent if
database is not normalized. To understand these anomalies let us take an example of
a Student table.
Anomalies in DBMS
There are three types of anomalies that occur when the database is not normalized.
These are – Insertion, update and deletion anomaly.
Example: Suppose a Software company stores the employee details in a table
named emp that has five attributes: eid for storing employee id ,ename for storing
employee name, eadd for storing employee address , edept for storing the
department information and emno for storing employee mobile no in which the
employee works. Lets see this table this is not normalized.
eid ename eadd edept emno
101 Ravi Kanpur ed101 777799
101 Ravi Kanpur ed103 777799
102 Karim Kannauj ed105 555555
103 Raju Hamirpur ed110 434434
103 Raju Hamirpur ed111 343434
Update anomaly: In the above table we have two rows for employee
Ravi as he belongs to two departments of the software company. If we
want to update the address of Ravi then we have to update the same
in two rows or the data will become inconsistent.
Insert anomaly: Suppose a new employee joins the company, who is
under training and currently not assigned to any department then we
would not be able to insert the data into the table if edept field
doesn’t allow nulls.
Delete anomaly: Suppose, if at a point of time the company closes the
department ed105 then deleting the rows that are having edept as
ed105 would also delete the information of employee Karim since he is
assigned only to this department.
There are different types of Normalization. In this slide we explain only
1NF , 2NF and 3NF.
1 Normalization Form (1NF): The first normal form expects you to follow a
few simple rules while designing your database, and they are:
Rule 1: Single Valued Attributes
Rule 2: Attribute Domain should not change
Rule 3: Unique name for Attributes/Columns
Rule 4: Order doesn't matters
eid ename eadd edept emno
101 Ravi Kanpur ed101 777799
777799
102 Karim Kannauj ed105 555555
103 Raju Hamirpur ed110 434434
434434
104 Piyush Lucknow ed111 343434
eid ename eadd edept emno
101 Ravi Kanpur ed101 777799
101 Ravi Kanpur ed101 777799
102 Karim Kannauj ed105 555555
103 Raju Hamirpur ed110 434434
103 Raju Hamirpur ed110 434434
104 Piyush Lucknow ed111 343434
Now This table employee atomic.
2 Normalization Form (2NF):
A table is said to be in 2NF if both the following conditions hold:
 Table is in 1NF (First normal form)
 No non-prime attribute is dependent on the proper subset of any candidate key of table. There
should be no Partial Dependency.
An attribute that is not part of any candidate key is known as non-prime attribute.
Example: Suppose a college wants to store the data of teachers and the subjects they teach. They
create a table that looks like this: Since a teacher can teach more than one subjects, the table can
have multiple rows for a same teacher.
tid tsub tage
101 C 30
101 C++ 30
102 Python 32
103 C++ 35
103 DBMS 35
Candidate Keys: {tid, tsub}
Non prime attribute: tage
The table is in 1 NF because each attribute has atomic values. However, it is not in 2NF
because non prime attribute tage is dependent on tid alone which is a proper subset of
candidate key. This violates the rule for 2NF as the rule says “no non-prime attribute is
dependent on the proper subset of any candidate key of the table”. To make the table
complies with 2NF we can break it in two tables like this, Now the tables comply with Second
normal form (2NF).
tid tage
101 30
102 32
103 35
tid tsub
101 C
101 C++
102 Python
103 C++
103 DBMS
3 Normalization Form (3NF):
A table design is said to be in 3NF if both the following conditions hold:
 Table must be in 2NF
 Transitive functional dependency of non-prime attribute on any super key should be removed.
An attribute that is not part of any candidate key is known as non-prime attribute. In other words 3NF
can be explained like this: A table is in 3NF if it is in 2NF and for each functional dependency X-> Y at
least one of the following conditions hold:
 X is a super key of table
 Y is a prime attribute of table.
An attribute that is a part of one of the candidate keys is known as prime attribute.
Example: Suppose a company wants to store the complete address of each customer, they create a
table named cust that looks like this:
cid cname cpincode cstate ccity cdistrict
101 Ravi 110010 MP Satna abc
102 Rahul 110019 CG Raipur ccd
103 Rakesh 110017 CG Bilaspur ppd
104 Lalit 110013 UP Kanpur lll
105 Piyush 110014 AP Tirupati ooo
Super keys: {cid}, {cid, cname}, {cid,cname,cpincode}…so on
Candidate Keys: {cid}
Non-prime attributes: all attributes except cid are non-prime as they are not part of any candidate keys.
Here, cstate, ccity & cdistrict dependent on cpincode And, cpincode is dependent on cid that makes
non-prime attributes (cstate, ccity & cdistrict) transitively dependent on super key (cid). This violates the
rule of 3NF.
To make this table complies with 3NF we have to break the table into two tables to remove the transitive
dependency:
cid cname cpincode
101 Ravi 110010
102 Rahul 110019
103 Rakesh 110017
104 Lalit 110013
105 Piyush 110014
cpincode cstate ccity cdistrict
110010 MP Satna abc
110019 CG Raipur ccd
110017 CG Bilaspur ppd
110013 UP Kanpur lll
110014 AP Tirupati ooo
Thank You
Ad

More Related Content

What's hot (20)

Dependency preserving
Dependency preservingDependency preserving
Dependency preserving
Jagadeesh Boddipu
 
DBMS 3.pdf
DBMS 3.pdfDBMS 3.pdf
DBMS 3.pdf
NithishReddy90
 
Functional dependency
Functional dependencyFunctional dependency
Functional dependency
Sakshi Jaiswal
 
Decomposition using Functional Dependency
Decomposition using Functional DependencyDecomposition using Functional Dependency
Decomposition using Functional Dependency
Raj Naik
 
DBMS 3 | ER Diagram to Relational Schema
DBMS 3 | ER Diagram to Relational SchemaDBMS 3 | ER Diagram to Relational Schema
DBMS 3 | ER Diagram to Relational Schema
Mohammad Imam Hossain
 
Functional dependency
Functional dependencyFunctional dependency
Functional dependency
Dashani Rajapaksha
 
SQL Views
SQL ViewsSQL Views
SQL Views
baabtra.com - No. 1 supplier of quality freshers
 
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with ExamplesDML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
Lecture 04 normalization
Lecture 04 normalization Lecture 04 normalization
Lecture 04 normalization
emailharmeet
 
Fragmentation and types of fragmentation in Distributed Database
Fragmentation and types of fragmentation in Distributed DatabaseFragmentation and types of fragmentation in Distributed Database
Fragmentation and types of fragmentation in Distributed Database
Abhilasha Lahigude
 
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NFNormalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Biplap Bhattarai
 
Bcnf
BcnfBcnf
Bcnf
baabtra.com - No. 1 supplier of quality freshers
 
Joins in dbms and types
Joins in dbms and typesJoins in dbms and types
Joins in dbms and types
university of Gujrat, pakistan
 
7. Relational Database Design in DBMS
7. Relational Database Design in DBMS7. Relational Database Design in DBMS
7. Relational Database Design in DBMS
koolkampus
 
Functional dependency and normalization
Functional dependency and normalizationFunctional dependency and normalization
Functional dependency and normalization
University of Potsdam
 
Functional Dependency
Functional DependencyFunctional Dependency
Functional Dependency
Alaanoor94
 
Databases: Normalisation
Databases: NormalisationDatabases: Normalisation
Databases: Normalisation
Damian T. Gordon
 
Normalization in a Database
Normalization in a DatabaseNormalization in a Database
Normalization in a Database
Bishrul Haq
 
Distributed database management systems
Distributed database management systemsDistributed database management systems
Distributed database management systems
Dhani Ahmad
 
Integrity constraints in dbms
Integrity constraints in dbmsIntegrity constraints in dbms
Integrity constraints in dbms
Vignesh Saravanan
 
Decomposition using Functional Dependency
Decomposition using Functional DependencyDecomposition using Functional Dependency
Decomposition using Functional Dependency
Raj Naik
 
DBMS 3 | ER Diagram to Relational Schema
DBMS 3 | ER Diagram to Relational SchemaDBMS 3 | ER Diagram to Relational Schema
DBMS 3 | ER Diagram to Relational Schema
Mohammad Imam Hossain
 
Lecture 04 normalization
Lecture 04 normalization Lecture 04 normalization
Lecture 04 normalization
emailharmeet
 
Fragmentation and types of fragmentation in Distributed Database
Fragmentation and types of fragmentation in Distributed DatabaseFragmentation and types of fragmentation in Distributed Database
Fragmentation and types of fragmentation in Distributed Database
Abhilasha Lahigude
 
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NFNormalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Biplap Bhattarai
 
7. Relational Database Design in DBMS
7. Relational Database Design in DBMS7. Relational Database Design in DBMS
7. Relational Database Design in DBMS
koolkampus
 
Functional dependency and normalization
Functional dependency and normalizationFunctional dependency and normalization
Functional dependency and normalization
University of Potsdam
 
Functional Dependency
Functional DependencyFunctional Dependency
Functional Dependency
Alaanoor94
 
Normalization in a Database
Normalization in a DatabaseNormalization in a Database
Normalization in a Database
Bishrul Haq
 
Distributed database management systems
Distributed database management systemsDistributed database management systems
Distributed database management systems
Dhani Ahmad
 
Integrity constraints in dbms
Integrity constraints in dbmsIntegrity constraints in dbms
Integrity constraints in dbms
Vignesh Saravanan
 

Similar to Data normalization (20)

Database normalization
Database normalizationDatabase normalization
Database normalization
VARSHAKUMARI49
 
MODULE 4 -Normalization_1.ppt
MODULE 4 -Normalization_1.pptMODULE 4 -Normalization_1.ppt
MODULE 4 -Normalization_1.ppt
BelkinAntony1
 
24042020_normalization 1.pdf
24042020_normalization 1.pdf24042020_normalization 1.pdf
24042020_normalization 1.pdf
Shivani139202
 
UNIT 2 -PPT.pptx
UNIT 2 -PPT.pptxUNIT 2 -PPT.pptx
UNIT 2 -PPT.pptx
hemamalinikrishnan2
 
DBMS-Normalization.ppt
DBMS-Normalization.pptDBMS-Normalization.ppt
DBMS-Normalization.ppt
KalpanaThakre2
 
Normalization
NormalizationNormalization
Normalization
Mohd Mastana
 
DBMS Unit 3.pptx
DBMS Unit 3.pptxDBMS Unit 3.pptx
DBMS Unit 3.pptx
AmitDrKhare
 
normalization ppt.pptx
normalization ppt.pptxnormalization ppt.pptx
normalization ppt.pptx
AbdusSadik
 
UNIT-IV.ppt
UNIT-IV.pptUNIT-IV.ppt
UNIT-IV.ppt
Minu Choudhary
 
Normalization
NormalizationNormalization
Normalization
baabtra.com - No. 1 supplier of quality freshers
 
Unit05 dbms
Unit05 dbmsUnit05 dbms
Unit05 dbms
arnold 7490
 
DBMS_UNIT_IV.pptxbdndjdkdjdndjkdkdkdkdkdkdk
DBMS_UNIT_IV.pptxbdndjdkdjdndjkdkdkdkdkdkdkDBMS_UNIT_IV.pptxbdndjdkdjdndjkdkdkdkdkdkdk
DBMS_UNIT_IV.pptxbdndjdkdjdndjkdkdkdkdkdkdk
KGowtham16
 
Normalization
NormalizationNormalization
Normalization
Sakshi Jaiswal
 
module-3 Functional Dependency & Key Generation.pptx
module-3 Functional Dependency & Key Generation.pptxmodule-3 Functional Dependency & Key Generation.pptx
module-3 Functional Dependency & Key Generation.pptx
sureshm491823
 
DBMS_Module 3_Functional Dependencies and Normalization.pptx
DBMS_Module 3_Functional Dependencies and Normalization.pptxDBMS_Module 3_Functional Dependencies and Normalization.pptx
DBMS_Module 3_Functional Dependencies and Normalization.pptx
shruthis866876
 
Normalization.pdf
Normalization.pdfNormalization.pdf
Normalization.pdf
abhijose1
 
DBMS e evevevevevevevbebrbbrbrbrbrbrbrb 4.ppt
DBMS e  evevevevevevevbebrbbrbrbrbrbrbrb 4.pptDBMS e  evevevevevevevbebrbbrbrbrbrbrbrb 4.ppt
DBMS e evevevevevevevbebrbbrbrbrbrbrbrb 4.ppt
7c7fs5n555
 
DBMS MODULE-5 normalisation in database management
DBMS MODULE-5 normalisation in database managementDBMS MODULE-5 normalisation in database management
DBMS MODULE-5 normalisation in database management
SunilRamtri
 
functional dependency in engineering.pptx
functional dependency in engineering.pptxfunctional dependency in engineering.pptx
functional dependency in engineering.pptx
amanchouhan9917
 
Introduction to database-Normalisation
Introduction to database-NormalisationIntroduction to database-Normalisation
Introduction to database-Normalisation
Ajit Nayak
 
Database normalization
Database normalizationDatabase normalization
Database normalization
VARSHAKUMARI49
 
MODULE 4 -Normalization_1.ppt
MODULE 4 -Normalization_1.pptMODULE 4 -Normalization_1.ppt
MODULE 4 -Normalization_1.ppt
BelkinAntony1
 
24042020_normalization 1.pdf
24042020_normalization 1.pdf24042020_normalization 1.pdf
24042020_normalization 1.pdf
Shivani139202
 
DBMS-Normalization.ppt
DBMS-Normalization.pptDBMS-Normalization.ppt
DBMS-Normalization.ppt
KalpanaThakre2
 
DBMS Unit 3.pptx
DBMS Unit 3.pptxDBMS Unit 3.pptx
DBMS Unit 3.pptx
AmitDrKhare
 
normalization ppt.pptx
normalization ppt.pptxnormalization ppt.pptx
normalization ppt.pptx
AbdusSadik
 
DBMS_UNIT_IV.pptxbdndjdkdjdndjkdkdkdkdkdkdk
DBMS_UNIT_IV.pptxbdndjdkdjdndjkdkdkdkdkdkdkDBMS_UNIT_IV.pptxbdndjdkdjdndjkdkdkdkdkdkdk
DBMS_UNIT_IV.pptxbdndjdkdjdndjkdkdkdkdkdkdk
KGowtham16
 
module-3 Functional Dependency & Key Generation.pptx
module-3 Functional Dependency & Key Generation.pptxmodule-3 Functional Dependency & Key Generation.pptx
module-3 Functional Dependency & Key Generation.pptx
sureshm491823
 
DBMS_Module 3_Functional Dependencies and Normalization.pptx
DBMS_Module 3_Functional Dependencies and Normalization.pptxDBMS_Module 3_Functional Dependencies and Normalization.pptx
DBMS_Module 3_Functional Dependencies and Normalization.pptx
shruthis866876
 
Normalization.pdf
Normalization.pdfNormalization.pdf
Normalization.pdf
abhijose1
 
DBMS e evevevevevevevbebrbbrbrbrbrbrbrb 4.ppt
DBMS e  evevevevevevevbebrbbrbrbrbrbrbrb 4.pptDBMS e  evevevevevevevbebrbbrbrbrbrbrbrb 4.ppt
DBMS e evevevevevevevbebrbbrbrbrbrbrbrb 4.ppt
7c7fs5n555
 
DBMS MODULE-5 normalisation in database management
DBMS MODULE-5 normalisation in database managementDBMS MODULE-5 normalisation in database management
DBMS MODULE-5 normalisation in database management
SunilRamtri
 
functional dependency in engineering.pptx
functional dependency in engineering.pptxfunctional dependency in engineering.pptx
functional dependency in engineering.pptx
amanchouhan9917
 
Introduction to database-Normalisation
Introduction to database-NormalisationIntroduction to database-Normalisation
Introduction to database-Normalisation
Ajit Nayak
 
Ad

More from Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi) (20)

String Manipulation Function and Header File Functions
String Manipulation Function and Header File FunctionsString Manipulation Function and Header File Functions
String Manipulation Function and Header File Functions
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
C Structure and Union in C
C Structure and Union in CC Structure and Union in C
C Structure and Union in C
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Preprocessor Directive in C
Preprocessor Directive in CPreprocessor Directive in C
Preprocessor Directive in C
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
File Handling in C Programming
File Handling in C ProgrammingFile Handling in C Programming
File Handling in C Programming
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Bit field enum and command line arguments
Bit field enum and command line argumentsBit field enum and command line arguments
Bit field enum and command line arguments
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Pointers in C and Dynamic Memory Allocation
Pointers in C and Dynamic Memory AllocationPointers in C and Dynamic Memory Allocation
Pointers in C and Dynamic Memory Allocation
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Array in C
Array in CArray in C
Array in C
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
C storage class
C storage classC storage class
C storage class
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Function in C Programming
Function in C ProgrammingFunction in C Programming
Function in C Programming
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
C Constructs (C Statements & Loop)
C Constructs (C Statements & Loop)C Constructs (C Statements & Loop)
C Constructs (C Statements & Loop)
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
C Operators
C OperatorsC Operators
C Operators
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
C programming Basics
C programming BasicsC programming Basics
C programming Basics
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Software Development Skills and SDLC
Software Development Skills and SDLCSoftware Development Skills and SDLC
Software Development Skills and SDLC
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Mobile commerce
Mobile commerceMobile commerce
Mobile commerce
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
E commerce application
E commerce applicationE commerce application
E commerce application
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Html Form Controls
Html Form ControlsHtml Form Controls
Html Form Controls
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Security issue in e commerce
Security issue in e commerceSecurity issue in e commerce
Security issue in e commerce
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
ER to Relational Mapping
ER to Relational MappingER to Relational Mapping
ER to Relational Mapping
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship Model
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Database connectivity with data reader by varun tiwari
Database connectivity with data reader by varun tiwariDatabase connectivity with data reader by varun tiwari
Database connectivity with data reader by varun tiwari
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Ad

Recently uploaded (20)

To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
Social Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy StudentsSocial Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy Students
DrNidhiAgarwal
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Library Association of Ireland
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdfBiophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
PKLI-Institute of Nursing and Allied Health Sciences Lahore , Pakistan.
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Library Association of Ireland
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
Social Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy StudentsSocial Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy Students
DrNidhiAgarwal
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Library Association of Ireland
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Library Association of Ireland
 

Data normalization

  • 2. OBJECTIVES  To understand about the functional dependencies.  To bring out solution of Trivial , non-trivial , full dependency and transitive.  To known about the Armstrong inferences rules.  To understand about data normalization.
  • 3. Functional Dependencies 1. It is important role play to design a good or bad database. 2. Basically functional dependencies is a type of constraints that is a generalization in the notation of key. 3. Functional Dependency (FD) determines the relation of one attribute to another attribute in a database management system (DBMS) system. 4. Functional dependency in DBMS, as the name suggests is a relationship between attributes of a table dependent on each other. Introduced by E. F. Codd, it helps in preventing data redundancy and gets to know about bad designs. 5. It is represented by -> (arrow) sign. Ex- P -> Q. 6. It is a set of legal relation. Its depicts relationship of attributes. 7. For any relation r containing attributes P and Q and if for every valid instance of P determines uniquely value of Q It is expressed as:  P -> Q  P determines Q  Q dependent P or Q is determines by P
  • 4. Let f: P -> Q Relation so that P -> compute the value of Q. Fig1. Fig2.  P & Q in set of attributes.  This is the value which is store in P & Q. here we see that value is not duplicate in both row,  In this fig1. we easily search any value of P. suppose if you want to search the value of a1 so you can easily find the value of a1.  In this fig2. we don’t say what is the actual value of a1. so that F(P) - Q a1  10 a1  20 b1  10 Here we see this example. It is possible to meet same value of dependent but not possible determines is same. P Q a1 10 b1 20 c1 30 d1 40 P Q a1 10 a1 20 c1 30 d1 40
  • 5. It is a relationship that exists when one attributes uniquely determines another attributes.  If R is relation with all P & Q Uniquely Determination P -> Q Q is functional dependency on P -> It is a set of constrains between 2 attributes in a relations. Q is functional dependent on P Identification key P -> Q Eg: if every attribute Q of R dependent of P then attributes P is primary key. In this table SSN -> FNAME SSN -> LNAME So it dependent of a particular table. SSN Fname Lname 101 Ravi Kumar 102 Piyush Tiwari 103 Kartik Mishra 104 Harish Prasad
  • 6. Fully Functional Dependency: ABC - D 1. D is fully functional dependent on ABC 2. D cannot dependent on any subset of ABC BC -> D C -> D A -> D This is not possible because BC cannot determine D , C cannot determine D and A cannot determine D. In ABC -> D , only D is fully functional dependence of ABC. Sid sname tid smarks 101 Ravi 201 34 102 Piyush 202 44 103 Kartik 203 55 104 Harish 204 33
  • 7. Here in this table sid,tid  Identification Key so that marks is fully dependent of sid & Pid. This is combination of two attributes full functionally dependent. Transitive Dependency: Consider attributes PQ & R When P -> Q & Q -> R If full dependency one transitive also have the FD : A -> C C is transitive dependent on P through Q. Here we consider two tables Employee & Department. Eno -> Dno P-> Q P Q Q R Same as Eno -> email P -> Q Eno -> dno , dno -> dname , eno  dname so that P -> Q , Q -> R so that P -> R This is transitive dependency. Eno Email Dno Dname
  • 8. Trivial function dependency : Trivial dependency is a set of attributes which are called a trivial if the set of attributes are included in that attributes. So that P -> Q is a trivial if Q is subset of P. Ex-: [sid , sname]  sid is a trivial dependency as sid is a subset of [sid,sname]. Non - Trivial function dependency : In this dependency which also known non-trivial occurs when P -> Q holds true where Q is not subset of P. In attributes Q is not subset of P. Sid -> sname or P -> Q and sname -> sdob Q -> R Sid sname 101 Ravi 102 Piyush 103 Kartik 104 Harish Sid sname sdob 101 Ravi 1 102 Piyush 2 103 Kartik 3 104 Harish 4
  • 9. Armstrong Inferences Rules: The term Armstrong axioms to the sound and complete set of inference rules or axioms, introduced by William W. Armstrong, that is used to test the logical implication of functional dependencies. If F is a set of functional dependencies then the closure of F, denoted as F plus, is the set of all functional dependencies logically implied by F. Armstrong’s Axioms are a set of rules, that when applied repeatedly, generates a closure of functional dependencies.  It is a basic rule.  It are used to conclude functional dependencies on a relational database.  The inference rule is a type of assertion. It can apply to a set of FD(functional dependency) to derive other FD.  By using of this , we can derive additional functional dependency from the initial set.
  • 11. 1. Reflexive Rule according to reflexive rule, if B is a subset of A, then A determines B. If A ⊇ B then A → B eid - > eid A = {eid,ename,eage} B = {eid,ename} 2. Augmentation Rule The augmentation is also called as a partial dependency. In augmentation, if A determines B, then AC determines BC for any C. If A → B then AC → BC Example: For R(ABC), if A → B then AC → BC
  • 12. 3. Transitive Rule In the transitive rule, if A determines B and B determine C, then A must also determine C. If A → B and B → C then A → C 4. Union Rule Union rule says, if A determines B and A determines C, then A must also determine B and C. If A → B and A → C then A → BC 1. A → B (given) 2. A → C (given) 3. A → AB (using 2 rules on 1 by augmentation with A. Where AA = A) 4. AB → BC (using 2 rules on 2 by augmentation with B) 5. A → BC (using 3 rules on 3 and 4)
  • 13. 5. Decomposition Rule Decomposition rule is also known as project rule. It is the reverse of union rule. This Rule says, if A determines B and C, then A determines B and A determines C separately. If A → BC then A → B and A → C 1. A → BC (given) 2. BC → B (using rule 1) 3. A → B (using rule 3 on 1 and 2) 6. Pseudo transitive Rule If A holds B and BC holds D, then AC holds D. If {A → B} and {BC → D}, then {AC → D} 1. A → B (given) 2. DB → C (given) 3. DA → DB (By using 2 rule on 1 by augmenting with D) 4. DA → C (by using 3 rule on 3 and 2)
  • 14. Example: Consider relation E = (P, Q, R, S, T, U) having set of Functional Dependencies (FD). P -> Q P -> R QR -> S Q -> T QR -> U PR -> U Calculate some members of Axioms are as follows, 1. P -> T 2. PR -> S 3. QR -> SU 4. PR -> SU Solution: 1. P -> T In the above FD set, P -> Q and Q -> T So, Using Transitive Rule: If {P -> Q} and {Q -> T}, then {P -> T} ? If P -> Q and Q -> T, then P -> T. P -> T
  • 15. 2. PR -> S In the above FD set, P -> Q As, QR -> S So, Using Pseudo Transitivity Rule: If{A -> B} and {BC -> D}, then {AC -> D} If P -> Q and QR -> S, then PR -> S. PR -> S 3. QR -> SU In above FD set, QR -> S and QR -> U So, Using Union Rule: If{A -> B} and {A -> C}, then {A -> BC} If QR -> S and QR -> U, then QR -> SU. QR -> SU 4. PR -> SU So, Using Pseudo Transitivity Rule: If{A -> B} and {BC -> D}, then {AC -> D} If PR -> S and PR -> U, then PR -> SU. PR -> SU
  • 30. Data Normalization Database Normalization is a technique of organizing the data in the database. Normalization is a systematic approach of decomposing tables to eliminate data redundancy(repetition) and undesirable characteristics like Insertion, Update and Deletion Anomalies. It is a multi-step process that puts data into tabular form, removing duplicated data from the relation tables.  Normalization is used for mainly two purposes,  Eliminating redundant(useless) data.  Ensuring data dependencies make sense i.e. data is logically stored. Problems Without Normalization If a table is not properly normalized and have data redundancy then it will not only eat up extra memory space but will also make it difficult to handle and update the database, without facing data loss. Insertion, Updating and Deletion Anomalies are very frequent if database is not normalized. To understand these anomalies let us take an example of a Student table.
  • 31. Anomalies in DBMS There are three types of anomalies that occur when the database is not normalized. These are – Insertion, update and deletion anomaly. Example: Suppose a Software company stores the employee details in a table named emp that has five attributes: eid for storing employee id ,ename for storing employee name, eadd for storing employee address , edept for storing the department information and emno for storing employee mobile no in which the employee works. Lets see this table this is not normalized. eid ename eadd edept emno 101 Ravi Kanpur ed101 777799 101 Ravi Kanpur ed103 777799 102 Karim Kannauj ed105 555555 103 Raju Hamirpur ed110 434434 103 Raju Hamirpur ed111 343434
  • 32. Update anomaly: In the above table we have two rows for employee Ravi as he belongs to two departments of the software company. If we want to update the address of Ravi then we have to update the same in two rows or the data will become inconsistent. Insert anomaly: Suppose a new employee joins the company, who is under training and currently not assigned to any department then we would not be able to insert the data into the table if edept field doesn’t allow nulls. Delete anomaly: Suppose, if at a point of time the company closes the department ed105 then deleting the rows that are having edept as ed105 would also delete the information of employee Karim since he is assigned only to this department. There are different types of Normalization. In this slide we explain only 1NF , 2NF and 3NF.
  • 33. 1 Normalization Form (1NF): The first normal form expects you to follow a few simple rules while designing your database, and they are: Rule 1: Single Valued Attributes Rule 2: Attribute Domain should not change Rule 3: Unique name for Attributes/Columns Rule 4: Order doesn't matters eid ename eadd edept emno 101 Ravi Kanpur ed101 777799 777799 102 Karim Kannauj ed105 555555 103 Raju Hamirpur ed110 434434 434434 104 Piyush Lucknow ed111 343434
  • 34. eid ename eadd edept emno 101 Ravi Kanpur ed101 777799 101 Ravi Kanpur ed101 777799 102 Karim Kannauj ed105 555555 103 Raju Hamirpur ed110 434434 103 Raju Hamirpur ed110 434434 104 Piyush Lucknow ed111 343434 Now This table employee atomic.
  • 35. 2 Normalization Form (2NF): A table is said to be in 2NF if both the following conditions hold:  Table is in 1NF (First normal form)  No non-prime attribute is dependent on the proper subset of any candidate key of table. There should be no Partial Dependency. An attribute that is not part of any candidate key is known as non-prime attribute. Example: Suppose a college wants to store the data of teachers and the subjects they teach. They create a table that looks like this: Since a teacher can teach more than one subjects, the table can have multiple rows for a same teacher. tid tsub tage 101 C 30 101 C++ 30 102 Python 32 103 C++ 35 103 DBMS 35
  • 36. Candidate Keys: {tid, tsub} Non prime attribute: tage The table is in 1 NF because each attribute has atomic values. However, it is not in 2NF because non prime attribute tage is dependent on tid alone which is a proper subset of candidate key. This violates the rule for 2NF as the rule says “no non-prime attribute is dependent on the proper subset of any candidate key of the table”. To make the table complies with 2NF we can break it in two tables like this, Now the tables comply with Second normal form (2NF). tid tage 101 30 102 32 103 35 tid tsub 101 C 101 C++ 102 Python 103 C++ 103 DBMS
  • 37. 3 Normalization Form (3NF): A table design is said to be in 3NF if both the following conditions hold:  Table must be in 2NF  Transitive functional dependency of non-prime attribute on any super key should be removed. An attribute that is not part of any candidate key is known as non-prime attribute. In other words 3NF can be explained like this: A table is in 3NF if it is in 2NF and for each functional dependency X-> Y at least one of the following conditions hold:  X is a super key of table  Y is a prime attribute of table. An attribute that is a part of one of the candidate keys is known as prime attribute. Example: Suppose a company wants to store the complete address of each customer, they create a table named cust that looks like this:
  • 38. cid cname cpincode cstate ccity cdistrict 101 Ravi 110010 MP Satna abc 102 Rahul 110019 CG Raipur ccd 103 Rakesh 110017 CG Bilaspur ppd 104 Lalit 110013 UP Kanpur lll 105 Piyush 110014 AP Tirupati ooo Super keys: {cid}, {cid, cname}, {cid,cname,cpincode}…so on Candidate Keys: {cid} Non-prime attributes: all attributes except cid are non-prime as they are not part of any candidate keys. Here, cstate, ccity & cdistrict dependent on cpincode And, cpincode is dependent on cid that makes non-prime attributes (cstate, ccity & cdistrict) transitively dependent on super key (cid). This violates the rule of 3NF. To make this table complies with 3NF we have to break the table into two tables to remove the transitive dependency:
  • 39. cid cname cpincode 101 Ravi 110010 102 Rahul 110019 103 Rakesh 110017 104 Lalit 110013 105 Piyush 110014 cpincode cstate ccity cdistrict 110010 MP Satna abc 110019 CG Raipur ccd 110017 CG Bilaspur ppd 110013 UP Kanpur lll 110014 AP Tirupati ooo