CH-4 DBMS Normalisation
CH-4 DBMS Normalisation
Normalization of Relations
• Normal form: Condition using keys and FDs of a relation to certify whether a
relation schema is in a particular normal form
Purpose of Normalization
➢ Spurious Tuples
Semantics of the Relation Attributes
GUIDELINE 1: Informally, each tuple in a relation should represent one entity
or relationship instance. (Applies to individual relations and their attributes).
Update Anomaly: Changing the name of project number P1 from “Billing” to “Customer-
Accounting” may cause this update to be made for all 100 employees working on project
P1.
Delete Anomaly: When a project is deleted, it will result in deleting all the employees who
work on that project. Alternately, if an employee is the sole employee on a project,
deleting that employee would result in deleting the corresponding project.
Null Values in Tuples
• FDs and keys are used to define normal forms for relations
• FDs are constraints that are derived from the meaning and
interrelationships of the data attributes
7/14/2023
Definition
• X -> Y holds if whenever two tuples have the same value for X, they must have
the same value for Y.
• For any two tuples t1 and t2 in any relation instance r(R): If t1[X]=t2[X], then
t1[Y]=t2[Y]
• employee ssn and project number determines the hours per week that the employee
works on the project
{SSN, PNUMBER} -> HOURS
20
Definitions of Keys and Attributes Participating in Keys
7/14/2023
7/14/2023
Second Normal Form
Prime attribute - attribute that is member of the primary key K
Full functional dependency - a FD Y -> Z where removal of any attribute from Y
means the FD does not hold any more
Examples:- {SSN, PNUMBER} -> HOURS is a full FD since neither SSN -> HOURS
nor PNUMBER -> HOURS hold
{SSN, PNUMBER} -> ENAME is not a full FD (it is called a partial dependency )
since SSN -> ENAME also holds
• R can be decomposed into 2NF relations via the process of 2NF normalization
7/14/2023
Example
7/14/2023
7/14/2023
Third Normal Form
• Transitive functional dependency - a FD X -> Z that can be derived from two FDs X -> Y and
Y -> Z
Examples: SSN -> DMGRSSN is a transitive FD since SSN -> DNUMBER and DNUMBER ->
DMGRSSN hold SSN -> ENAME is non-transitive since there is no set of attributes X where SSN ->
X and X -> ENAME
• A relation schema R is in third normal form (3NF) if it is in 2NF and no non-
prime attribute A in R is transitively dependent on the primary key
• R can be decomposed into 3NF relations via the process of 3NF normalization
NOTE:
In X -> Y and Y -> Z, with X as the primary key, we consider this a problem only if Y is not a
candidate key. When Y is a candidate key, there is no problem with the transitive dependency .
E.g., Consider EMP (SSN, Emp#, Salary ).
Here, SSN -> Emp# -> Salary and Emp# is a candidate key.
7/14/2023
Thank You...!
DBMS Interview Questions And Answers
Q #3) Why is the use of DBMS recommended? Explain by listing some of its major
advantages.
DBMS Interview Questions And Answers
Q #5) What are the different types of languages that are available in the DBMS?
Q #8) What are the main differences between Primary key and Unique Key?
Q #10) What is the main difference between UNION and UNION ALL?