0% found this document useful (0 votes)
80 views13 pages

What Is A Relational Database?

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.

Uploaded by

venkat1008
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views13 pages

What Is A Relational Database?

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.

Uploaded by

venkat1008
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

1.

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.

What Is a Relational Database?

 Database includes multiple tables


 Tables contain a single subject
 Tables are joined by relationships
 Examples of relational databases:
 Microsoft Access
 Microsoft® SQL Server™
 Oracle

What Constitutes a Relational Database?

 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

 Only one matching record


 Uses primary key for both tables
 Use to limit access to information
One-to-Many Relationships

 Most common type of relationship


 Related between primary and foreign keys
 Can have many related records
 Referential integrity prevents orphaned records
Many-to-Many Relationships

 One order, many products


 One product, many orders
 Not directly supported between tables
 Use a junction table to relate

Why Normalize a Database?

 Eliminates redundant data


 Reduces chances of data errors
 Reduces disk space
ANOMALY:

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

Three Types of Anomalies


• Insertion Anomaly: A new item cannot be added to the table until at least one entity
uses a particular attribute item.
• Deletion Anomaly: If an attribute item used by only one entity is deleted, all information
about that attribute item is lost.
• Update Anomaly: A modification on an attribute must be made in each of the rows in
which the attribute appears.
• Anomalies can be corrected by creating relational tables.

Database Tables and Normalization


\
 Normalization is a process for assigning attributes to entities. It reduces data
redundancies and helps eliminate the data anomalies.
 Normalization works through a series of stages called normal forms:
– First normal form (1NF)
– Second normal form (2NF)
– Third normal form (3NF)
– Boyce-Codd Normal Form (BCNF)
– Fourth normal form (4NF)
The highest level of normalization is not always desirable
LEVELS OF NORMALIZATION:

FIRST NORMALFORM:

A relation is said to be in 1NF if and only if it contains simple domain for attributes.

(Or)

A relation is said to be in 1NF it has no repeating groups.

(Or)
A relation is said to be in 1NF if and only if all domains contain atomic values.
Here atomic means indivisible.

Consider the EMP and PROJ information is in 1NF

Proj No Proj Name Emp No Emp Name Job Class


1001 COLLEGE 103 Saritha DB _DESIGNER

1001 COLLEGE 109 NavTej PROGRAMMER

1001 COLLEGE 105 Lakshmi ANALYST

1002 ESPN 101 Venkat APPLN_DESIGNER

1002 ESPN 102 Uday DB_DESIGNER

1002 ESPN 105 Anitha ANALYST

1002 ESPN 106 Priya PROGRAMER


FUNCTIONAL DEPENDENCY:

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

We can saw a few anamalies.

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.

Steps for 2NF:

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.

The FD’s are

EMP (Emp No, Emp Name, Job Class, Chrg_hr)

PROJ (Proj No, Proj Name)

ASSIGN (Proj No, Emp No)


EMP NO
EMP NAME
EMP JOB CLASS
CHRG HR

EMPNO
PROJ NO
ASSIGN
HOURS

PROJ NO
PROJ PROJ NAME

EMP:

EmpNo EmpName Job_Class Charg_Hr


1103 Krishna DB DESIGNER 500
1109 Venki PROGRAMMER 200
1102 Tom Crusie ANALYST 350
1101 Nag APPLN DESIGNER 400
1104 Hari ANALYST 350
1105 Siri PROGRAMMER 200
1111 Praveen PROGRAMMER 200

PROJ:

Proj No Proj Name


1001 COLLEGE
1002 ESPN
1003 AXN

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:

A relation is said to be in 3NF if it is already in 2NF and it has no


“Transitive Dependency”.

(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.

The FD’s in EMP relation are:


Emp NO -> Emp Name

EMP No -> Job_ Class

EMP No -> Chrg_Hr

Job_Class -> Chrg_Hr

In the EMP relation there exits a transitive, in the following way.

EMP No -> Job-Class (a->b)

Job-Class -> chrg_Hr (b->c)

Emp No -> Chrg_hr (a->c)

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 (EmpNO, EName, Job_Class)

JOB (Job_Class, Chrg_Hr)

EMP:

EName
EMP NO

Job_Clas
s
JOB:

Job_Class Chrg_Hr

Boyce-Codd Normal Form (BCNF)

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.

PROJECT (PROJ_NUM, PROJ_NAME)

ASSIGN (PROJ_NUM, EMP_NUM, HOURS)


EMPLOYEE (EMP_NUM, EMP_NAME, JOB_CLASS)

JOB (JOB_CLASS, CHG_HOUR)

You might also like