NORMALISATION
NORMALISATION
NORMALISATION
Types of Anomalies
First Normal Form (1NF): This is the most basic level of normalization. In
1NF, each table cell should contain only a single or atomic value, and each
column should have a unique name. The first normal form helps to eliminate
duplicate data and simplify queries.
Example: Suppose a company wants to store the names and contact details
of its employees. It creates a table that looks like this:
You can see that the emp_mobile column has two values. Thus it does not
follow the First Normal Form. Now, if you use the First Normal Form to the
above table, you get the below table as a result.
To make the table complies with 2NF we can break it in two tables like this:
teacher_details table: teacher_subject table:
All attributes except emp_id are non-prime as they are not part of any candidate
keys. To make this table complies with 3NF we have to break the table into two
tables to remove the transitive dependency:
Boyce Codd Normal Form is also known as 3.5 NF. It is a strict version of 3NF. BCNF
ensures that each non-key attribute is dependent only on the candidate key.
Example: Suppose there is a company where employees work in more than one
department.
The table is not in BCNF as neither emp_id nor emp_dept alone are keys.To make
the table comply with BCNF we can break the table in three tables like this:
4NF is a further refinement of BCNF that ensures that a table does not contain any
multi-valued dependencies.
It is a concept that specifies the relationship between two sets of attributes where
one attribute determines the value of another attribute. It is denoted as X → Y,
where the attribute set on the left side of the arrow, X is called Determinant, and Y
is called the Dependent.
A then A → B.
Example, {roll_no, name} → name is valid.
Augmentation: If X → Y is a valid dependency, then XZ → YZ is also valid by
augmentation rule.
Example, {roll_no, name} → dept_building is valid, hence {roll_no, name,
dept_name} → {dept_building, dept_name} is also valid.
Transitivity: If X → Y and Y → Z are both valid dependencies, then X→Z is also
If X → Y and X → Z then X → YZ
If X → YZ then X → Y and X → Z
If X → Y and YZ → W then XZ → W
TRANSITIVE DEPENDENCY
MULTIVALUED DEPENDENCY
Types of Decomposition
1)Lossless Decomposition
We can follow certain rules to ensure that the decomposition is a lossless join
decomposition Let’s say we have a relation R and we decomposed it into R1 and R2,
then the rules are:
1. The union of attributes of both the sub relations R1 and R2 must contain all
2. The intersection of attributes of both the sub relations R1 and R2 must not
be null, i.e., there should be some attributes that are present in both R1 and
R2.
R1 ∩ R2 ≠ ∅
2)Lossy Decomposition
Whenever we decompose a relation into multiple relational schemas, then the loss
of data/information is unavoidable whenever we try to retrieve the original
relation.This is called as lossy decomposition.
DEPENDENCY PRESERVATION
In this technique, the original relation is decomposed into smaller relations in such
a way that the resulting relations preserve the functional dependencies of the
original relation. This is important because if the decomposition results in losing
any of the original functional dependencies, it can lead to data inconsistencies and
anomalies.
The SQL NULL is the term used to represent a missing value. A NULL value in a table
is a value in a field that appears to be blank. A field with a NULL value is a field with
no value & is totally different than a zero value.
In general null value does not impact anything until it is used just for showing the
status of any field. But once that field is used in mathematical calculation with
some other logical field then it can impact the outcome result.
Null values will also affect the aggregate function that incorporates the value of a
given field. If we were using an aggregate function, for example, a count function,
the result will always contain a null if the field contains a null.etc.
DANGLING TUPLES
In DBMS if there is a tuple that does not participate in a natural join we called it as
dangling tuple . It may gives indication consistency problem in the database.
Another definition of dangling problem tuple is that a tuple with a foreign key
value that not appear in the referenced relation is known as dangling tuple. In
DBMS Referential integrity constraints specify us exactly when dangling tuples
indicate problem.