What Is A Relational Database?
What Is A Relational Database?
INTRODUCTION:
Normalization (or) Relational data analysis is the technique used extensively for database design.
It is the work developed by Boycecodd which extensively used to automate the process of
database design.
Key fields
Primary key
Foreign key
Relationships
One-to-one
One-to-many
Many-to-many
Keys
Primary Key:
A minimal set of attributes that form a candidate key
Any attribute or collection of attributes that functionally determine all attributes in a record is a
Candidate Key.
Note: since no two rows in a relational table can be duplicates, the entire record is always a
candidate key.
Foreign Keys:
A value in the “child” table that matches with the related value in the “parent” table.
SalesRep(SalesRepNumber, Name)
[ 03 | Mary Jones ]
[ 124 | 03 ]
Customer(CustomerNumber, SalesRepNumber
Relationships
One-to-One Relationships
An error (or) inconsistency that may result when the user attempts to update a table that contains
redundant data.
There are 3 types of anamalies
Insertion anamaly
Deletion anamaly
Updation anamaly
FIRST NORMALFORM:
A relation is said to be in 1NF if and only if it contains simple domain for attributes.
(Or)
(Or)
A relation is said to be in 1NF if and only if all domains contain atomic values.
Here atomic means indivisible.
A Functional dependency is a constraint between two sets of attributes from the database.
The FD’s are
PROJ NAME
PROJ NO
HOURS
EMP NO
EMP NAME
JOB _CLASS
CHAG_ HR
Insertion:
We can’t insert the PROJ information in which employees are not assigned.
Deletion:
We delete a row in the relation we lose both PROJ information and EMP information.
Updation:
We can change the proj information name from x to y where we can face a problem with
inconsistency of data.
We can overcome this problem we can go to 2NF.
SECOND NORMALFORM:
The relation is said to be 2NF if and only if it is already in 1NF and every Non key attribute in a
relation must be fully functionally dependent on the primary key.
1. Verify if all the columns are dependent on the primary key or not.
2. Remove the columns that depend on the part of the key.
3. Place the partially dependent columns as a separate table.
4. Name those tables.
5. Identify the keys to those tables.
EMPNO
PROJ NO
ASSIGN
HOURS
PROJ NO
PROJ PROJ NAME
EMP:
PROJ:
ASSIGN:
Proj No EmpNo Hours
1001 103 15
1001 109 33
1001 112 10
1002 101 9
1002 103 32
1002 104 22
1002 105 29
1003 111 47
But still there exit few anomalies.
INSERTION:
We can’t enter the fact that a particular employee charges RS.999 until his job class is specified.
DELETION:
If we delete a row about an employee we lose both emp information, job class information.
UPDATION:
To change charge per hour of an employee we face with the problem of changing wherever it
occurred or will be left with inconsistent information.
THIRD NORMALFORM:
(Or)
A relation is in 3NF if and only if it is in 2NF and every non-key attribute is non-transitively
dependent on the primary key.
So, this is not in the 3 NF, so we decompose the EMP relation in to two relations.
EMP (EmpNO, EName, Job-Class, and Chrg-Hr) is decomposed in to the following two
relations.
EMP:
EName
EMP NO
Job_Clas
s
JOB:
Job_Class Chrg_Hr
BCNF Definition
A table is in BCNF if every determinant in that table is a candidate key. If a table contains only
one candidate key, 3NF and BCNF are equivalent.