Curs Normalization

14
7/23/2019 Curs Normalization http://slidepdf.com/reader/full/curs-normalization 1/14  NORMALIZATION LAURENTIU FRATILA, PH.D.

Transcript of Curs Normalization

Page 1: Curs Normalization

7/23/2019 Curs Normalization

http://slidepdf.com/reader/full/curs-normalization 1/14

 

NORMALIZATION

LAURENTIU FRATILA, PH.D.

Page 2: Curs Normalization

7/23/2019 Curs Normalization

http://slidepdf.com/reader/full/curs-normalization 2/14

 

Normalization is defined as a conceptual modeling technique that aimsprocessing attributes in entities in order to eliminate logical and physicalanomalies .

This will improve the conceptual modeling phase of data, resulting in improveddatabase structure and thus eliminate some malfunctions, such as redundancy,anomalies that may occur in the process of updating the database (anomaliesof adding, modifying , delete attributes).

During normalization, we use the term relationship for conceptual entity, too.The relationship is a lot of domains plus a lot of name-value pairs, one pair foreach domain and value are into the domain of the name.

Page 3: Curs Normalization

7/23/2019 Curs Normalization

http://slidepdf.com/reader/full/curs-normalization 3/14

 Anomalies in adding process: do not allow the introduction of newinformation in a table because other useful information are not known to inserta new tuple in the table.

Code_client 

Name_client 

Type_dep 

Date_dep 

 Amount 

Interest_rate 

12371   Anghel  D-1-M  02/03/13  1000  0.02 

12456 

Tudor 

D-3-M 

05/04/13 

700 

0.03 

15542   Vasile  D-6-M  07/06/04  1500  0.04 

17823 

Zainea 

D-12-M 

05/07/13 

3000 

0.06 

Page 4: Curs Normalization

7/23/2019 Curs Normalization

http://slidepdf.com/reader/full/curs-normalization 4/14

 Anomalies in changing process: can not be changed values of attributes foran entity without doing changes in all entities in which it appears that attribute.

Series_ID_cl 

No_ID_cl 

Name_cl 

Type_dep 

Date_dep 

 Amount 

Interest_ rate 

 AC 

153268 

 Anghel 

D-1-M 

02/03/13 

1000 

0.02 

 AZ  542689  Tudor  D-3-M  05/04/13  700  0.03 

ST  159834   Vasile  D-6-M  07/06/13  1500  0.04 

 AC 

153268 

 Anghel 

D-6-M 

02/05/13 

1000 

0.04 

SZ 

483267 

Zainea 

D-12-M 

05/07/13 

3000 

0.06 

Page 5: Curs Normalization

7/23/2019 Curs Normalization

http://slidepdf.com/reader/full/curs-normalization 5/14

 Anomalies in deleting process: deleting a tuple from an entity can generatedeleting useful information existing in that tuple.

Normalization is based on the theory of normal forms. The first three normalforms were defined by Codd, and the fourth and fifth normal forms weredefined by Fagin.

Code_client 

Name_client 

Type_dep 

Date_dep 

 Amount 

Interest_rate 

12371   Anghel  D-1-M  02/03/13  1000  0.02 

12456 

Tudor 

D-3-M 

05/04/13 

700 

0.03 

15542   Vasile  D-6-M  07/06/04  1500  0.04 

17823 

Zainea 

D-12-M 

05/07/13 

3000 

0.06 

Page 6: Curs Normalization

7/23/2019 Curs Normalization

http://slidepdf.com/reader/full/curs-normalization 6/14

The First Normal Form (NF1)   A relationship is in first normal form (NF1) if all attributes contain elementary

values, values that can not be decomposed. In the same time, each tuple does

not have to be repeated groups.

Steps to bring a relationship to NF1 are:  1. Decomposition the composed attributes in elementary attributes and replace

them in the relationship 2. Creating a new relationship for repetitive attributes

3. Set up new relationship identifier that will be formed from the initialrelationship identifier, plus a minimum number of attributes for defining amultiple identifier.

Page 7: Curs Normalization

7/23/2019 Curs Normalization

http://slidepdf.com/reader/full/curs-normalization 7/14

 

Code_cl  Name_cl  First_name_cl   Address_cl  Type_dep  No_dep 

123715 

 Anghel 

Marin  Cluj, str. Turda,

nr. 8 

D-1-M 

345 

124568  Tudor  Dragos  Iasi, str.Unirii, nr. 2

 

D-6-M  690 

Name_dep 

Date_dep 

 Amount  Interest_ 

rate 

Code_employee 

Name_ employee 

1 Month Deposit 

06/04/13 

200 

0.02 

123 

Ion Maria 

6 Months Deposit 

05/06/13 

500 

0.04 

125 

Radu Victor 

Page 8: Curs Normalization

7/23/2019 Curs Normalization

http://slidepdf.com/reader/full/curs-normalization 8/14

 

The Second Normal Form (NF2)   A relationship is in normal form 2 (NF2) if it comply with NF1 and every non-key

attribute is fully dependent on the primary key.

The non-key attribute is any attribute of the relationship, different from theprimary key

Steps to bring a relationship from NF1 to NF2 are:  Determination of partial dependencies between non-key attributes and key

attributes.

Creating new relationships that will include initial entity identifier, the attributesthat were determined in the previous step and all the attributes that aredetermined.

Set up new relationships identifiers, that will be formed from the initialrelationship identifier and the attributes/group of attributes that are directlydependent by the identifier, set up in step 1.

Page 9: Curs Normalization

7/23/2019 Curs Normalization

http://slidepdf.com/reader/full/curs-normalization 9/14

Code_cl 

Type_dep 

No_dep 

Name_dep 

Date_dep 

 Amount 

123715 

D-1-L 

345 

1 Month Deposit 

06/04/13 

200 

123715  D-6-L  690  6 Months Deposit  05/06/13  500 

123715 

D-3-L 

723  3 Months

Deposit 

07/06/13 

300 

Interes_rate  Code_employee  Name_employee 

0.02 

123 

Ion Maria 

0.04  125  Radu Victor 

0.03  456  Ion Maria 

Page 10: Curs Normalization

7/23/2019 Curs Normalization

http://slidepdf.com/reader/full/curs-normalization 10/14

 

The Third Normal Form (NF3)   A relationship is in normal form 3 (NF3) if it comply with NF2 and contains no

transitive dependencies of non-key attributes in relation to the primary key.

Steps to bring a relationship from NF2 to NF3 are: Determination of the attributes that are in a transitive dependency to the

primary key Creating of new relationships, determined by the previously set attributes and

the attributes that are determined plus initial entity identifier

Set up new relationships identifier, that will consist of the original relationshipidentifier and the attribute/group of attributes directly dependent by theidentifier set in step 1

Page 11: Curs Normalization

7/23/2019 Curs Normalization

http://slidepdf.com/reader/full/curs-normalization 11/14

 

Code_cl  Type_

dep 

No_dep

 

Name_dep  Date_

dep 

 Amount  Interest_ 

rate 

Code_employee

 

123715 

D-1-L 

345 

1 Month Deposit 

06/04/13 

200 

0.02 

123 

123715  D-6-L  690  6 MonthsDeposit 

05/06/13 

500  0.04  125 

Page 12: Curs Normalization

7/23/2019 Curs Normalization

http://slidepdf.com/reader/full/curs-normalization 12/14

 

Boyce-Codd Normal Form (BCNF)   A relationship is in Boyce-Codd Normal Form (BCNF) if and only if every

determinant is a candidate-key.

To develop normal forms, Boyce and Codd introduced the concept ofdeterminant.

 A determinant is any attribute, simple or compound, through any other attributeis fully functionally dependent.

Page 13: Curs Normalization

7/23/2019 Curs Normalization

http://slidepdf.com/reader/full/curs-normalization 13/14

The Fourth Normal Form (NF4)   A relationship is in the normal form 4 (NF4) if it is in NFBC and does not contain

multiple dependencies.

Code_employee  Function  Departament 

….. 

456  credit officer  credit 

457 

director 

credit 

457 

director 

credit 459  economist  marketing 

… 

Page 14: Curs Normalization

7/23/2019 Curs Normalization

http://slidepdf.com/reader/full/curs-normalization 14/14

 

In practice entities are transformed in compliance with the NF1-NF4.

Sometimes there are cases where it will make a de-normalization of the entities,

which lead to redundancies among the attributes of the model, but this,although not recommended, has the effect of certain reports easier getting fromthe bank management at some time.