Top Banner
30
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Normalization
Page 2: Normalization

NORMALIZATION

Rajishma [email protected]/ Rajishma

T Nairtwitter.com/usernamein.linkedin.com/in/profilename9020217968

Page 3: Normalization

Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring PartnerBaabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd

Page 4: Normalization

NORMALIZATION

Normalization is the process of removing potential anomalies from the database design.

These anomalies include:

– Insertion anomalies– Update anomalies– Deletion anomalies

Page 5: Normalization

INSERTION ANOMALIES

An insertion anomaly occurs when you can’t enter a record in because some data is missing.

Consider a database with the rule that every employee must be assigned to a project, but a newly hired employee doesn’t have a project yet.

One solution is to create a dummy project, but this puts bad data into your database and is not a good idea.

Page 6: Normalization

UPDATE ANOMALIES

Update anomalies occur when the same data is stored in more than one place.

This means whenever you have to make a change to the data, you must do it in several places.

The more times you have to edit the same data in multiple places, the more chances you have of making a mistake, causing inconsistent data.

Page 7: Normalization

DELETION ANOMALIES

causes other data to be lost Deletion anomalies occur when deleting a record accidently .

Page 8: Normalization

Normalization:– The process of decomposing unsatisfactory "bad"

relations by breaking up their attributes into smaller relations

Normal form:– Condition using keys and FDs of a relation to

certify whether a relation schema is in a particular normal form

Page 9: Normalization

FIRST NORMAL FORM

Only attribute values permitted are single atomic (or indivisible) values

Techniques to achieve first normal form– Remove attribute and place in separate relation– Expand the key– Use several atomic attributes

Page 10: Normalization
Page 11: Normalization
Page 12: Normalization

SECOND NORMAL FORM

Second Normal Form removes what are called “functional dependencies.”

Functional dependencies are groups of columns that depend on each other rather than on the key of the table.

Page 13: Normalization

Functional dependencies (FDs)– Are used to specify formal measures of the

"goodness" of relational designs– And keys are used to define normal forms for

relations– Are constraints that are derived from the meaning

and interrelationships of the data attributes A set of attributes x functionally depends a set of

attributes Y if the value of X determines a unique value for Y

Page 14: Normalization

X -> Y holds if whenever two tuples have the same valuefor 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] X -> Y in R specifies a constraint on all relation

instances r(R)

Page 15: Normalization

SECOND NORMAL FORM

Formal definition of 2NF is a table that is in 1NF and every non-primary-key column is fully functional dependent on the primary key.

Full functional dependency indicates that if A and B are columns of a table, B is fully dependent on A if B is functionally dependent on A but not on any proper subset of A.

Page 16: Normalization
Page 17: Normalization
Page 18: Normalization

TRANSITIONAL DEPENDENCY

Transitive functional dependency: a FD X -> Z that can be derived from two FDs X -> Y and Y -> Z

For example, consider a table with A, B, and C. If B is functional dependent on A and C is functional dependent on B , then C is transitively dependent on A via B (provided that A is not functionally dependent on B or C).

If a transitive dependency exists on the primary key, the table is not in 3NF.

`

Page 19: Normalization
Page 20: Normalization
Page 21: Normalization

BCNFA relation R is in Boyce/Codd N/F (BCNF) if and only if

every determinant is a candidate key. Here, determinant is a simple attribute or composite attribute on which some other attributes is fully functionally dependent.

Each normal form is strictly stronger than the previous oneEvery 2NF relation is in 1NFEvery 3NF relation is in 2NFEvery BCNF relation is in 3NF

There exist relations that are in 3NF but not in BCNF The goal is to have each relation in BCNF (or 3NF)

Page 22: Normalization

campus course class time Room/bldngeast English 101 1 8:00-9:00 212 AYE

east English 101 2 10:00-11:00 305 RFK

West English 101 3 8:00-9:00102 PPR

Page 23: Normalization

• no two buildings on any of the university campuses have the same name, thus ROOM/BLDG----->CAMPUS. As the determinant is not a candidate key this table is not in bcnf.

• R1(course, class, room/bldg, time)•

course class time Room/bldng

English 101 1 8:00-9:00 212 AYE

English 101 2 10:00-11:00 305RFK

English 101 3 8:00-9:00 102PPR

Page 24: Normalization

• R2(room/bldg, campus)

campus Room/bldng

east 212 AYEeast 305 RFKwest 102 PPR

Page 25: Normalization

Identify all candidate keys in the relation.Identify all functional dependencies in the

relation.

If functional dependencies exists in the relation where their determinants are not candidate keys for the relation, remove the functional dependencies by placing them in a new relation along with a copy of their determinant.

Page 26: Normalization

FOURTH NORMAL FORM

4NF: A relation that is in Boyce-Codd Normal Form and contains no MVDs.

BCNF to 4NF involves the removal of the MVD from the relation by placing the attribute(s) in a new relation along with a copy of the determinant

Page 27: Normalization

MVD multi-valued dependency

• Represents a dependency between attributes (for example, A, B, and C) in a relation, such that for each value of A there is a set of values for B, and a set of values for C. However, the set of values for B and C are independent of each other

Page 28: Normalization

50

NormalizationBCNF to 4NF Relations

Page 29: Normalization

If this presentation helped you, please visit our page facebook.com/baabtra and like it.

Thanks in advance.

www.baabtra.com | www.massbaab.com |www.baabte.com

Page 30: Normalization

Contact Us

Emarald Mall (Big Bazar Building)Mavoor Road, Kozhikode,Kerala, India.Ph: + 91 – 495 40 25 550

NC Complex, Near Bus StandMukkam, Kozhikode,Kerala, India.Ph: + 91 – 495 40 25 550

Start up VillageEranakulam,Kerala, India.

Email: [email protected]