Presentation is loading. Please wait.

Presentation is loading. Please wait.

By: Shiraj Mohamed M | MIS | SEUSL SHIRAJ MOHAMED M | MIS | SEUSL 1.

Similar presentations


Presentation on theme: "By: Shiraj Mohamed M | MIS | SEUSL SHIRAJ MOHAMED M | MIS | SEUSL 1."— Presentation transcript:

1 By: Shiraj Mohamed M | MIS | SEUSL SHIRAJ MOHAMED M | MIS | SEUSL 1

2 Basically, normalization is the process of structuring the tables in a database for maximum efficiency Normalization involves creating tables and establishing relationships between those tables to make the database more flexible by eliminating redundancy and inconstancies. NORMALIZATION SHIRAJ MOHAMED M | MIS | SEUSL 2

3 NORMALIZATION… Conceptual Modeling is a subjective process Therefore, the schema after the logical database design phase may not be very good (contain redundant data) However, there are formalisms to ensure that the schema is good. This process is called Normalization SHIRAJ MOHAMED M | MIS | SEUSL 3

4 NORMALIZATION… Relational database schema = set of relations Relation = set of attributes How we group the attributes to relations is very important SHIRAJ MOHAMED M | MIS | SEUSL 4

5 SCHEMA REFINEMENT…. DISCUSSED SHIRAJ MOHAMED M | MIS | SEUSL 5

6 Determine Functional dependencies for relation Find all keys in relation Normalize the relation SCHEMA REFINEMENT STEPS SHIRAJ MOHAMED M | MIS | SEUSL 6

7 There are many Normal Forms proposed to reduce redundancies Some of the well-known ones are: 1 st Normal Form 2 nd Normal Form 3 rd Normal Form Boyce-Codd Normal Form NORMALIZATION…. SHIRAJ MOHAMED M | MIS | SEUSL 7

8 Superkey: Set of attributes S in relation R that can be used to identify each tuple uniquely. Key: A key is a superkey with the additional property that removal of any attributes from the key will not satisfy the key condition REVIEW OF SOME TERMS… SHIRAJ MOHAMED M | MIS | SEUSL 8

9 Candidate Key: Each key of a relation is called a candidate key Primary Key: A candidate key is chosen to be the primary key Prime Attribute: an attribute which is a member of a candidate key Nonprime Attribute: An attribute which is not prime REVIEW OF SOME TERMS… SHIRAJ MOHAMED M | MIS | SEUSL 9

10 Identify repeating groups of fields Remove repeating groups to a separate tables. Identify the keys for the tables FIRST NORMAL FORM (1NF) SHIRAJ MOHAMED M | MIS | SEUSL 10

11 Check if all fields are dependent of the whole key Remove Fields That depend on part of the key Group Partially dependent fields as a separate table Name the tables Identify keys to the tables SECOND NORMAL FORM (2NF) SHIRAJ MOHAMED M | MIS | SEUSL 11

12 Remove Fields That Depend on other non key attribute Group interdependent fields as separate tables, identifies the key and name the tables THIRD NORMAL FORM (3NF) SHIRAJ MOHAMED M | MIS | SEUSL 12

13 Cus iDCus. Name Cus. AddressOrder No Order Date Item code ItDescUn.pric e Qty 100ABCKadawathaA C-1Dhal ABCKadawathaA C-5Anchor ABCKadawathaA C-10Tea ABCKadawathaA F-4Sunlight ABCKadawathaA F-7Vim ABCKadawathaA F-10Lux ABCKadawathaB C-10Tea ABCKadawathaB F-4Sunlight ABCKadawathaB F-7Vim EXAMPLE SHIRAJ MOHAMED M | MIS | SEUSL 13

14 Eliminate any duplicate or repeating columns or groups in the same table. Since a Customer can place/have many orders, the above table now can be break into two. Customer Details Table FIRST NORMAL FORM (1NF) Cus iDCus. Name Cus. Address 100ABCKadawatha SHIRAJ MOHAMED M | MIS | SEUSL 14

15 Order Details Table FIRST NORMAL FORM (1NF) … Cus iDOrder No Order Date Item code ItDescUn.pric e Qty 100A C-1Dhal A C-5Anchor A C-10Tea A F-4Sunlight A F-7Vim A F-10Lux B C-10Tea B F-4Sunlight B F-7Vim SHIRAJ MOHAMED M | MIS | SEUSL 15

16 Eliminate redundant data. Now the table structure is improved. But you will notice that the Order Date is repeated. So take that out from this table. SECOND NORMAL FORM (2NF) Cus iDOrder No Order Date 100A B Improved Order Details Table SHIRAJ MOHAMED M | MIS | SEUSL 16

17 Order-Item Table SECOND NORMAL FORM (2NF)… Order No Item code ItDescUn.pric e Qty A-10C-1Dhal A-10C-5Anchor A-10C-10Tea A-10F-4Sunlight A-10F-7Vim A-10F-10Lux B-40C-10Tea B-40F-4Sunlight B-40F-7Vim SHIRAJ MOHAMED M | MIS | SEUSL 17

18 Eliminate fields that do not depend on the primary key You can notice that the Item Descriptions, Unit Price are not depend on the Oder No. So easily we can take them out from this Order-Item table. Improved Order-Item Table THIRD NORMAL FORM (3NF) SHIRAJ MOHAMED M | MIS | SEUSL 18

19 THIRD NORMAL FORM (3NF) … Order No Item code Qty A-10C-15 A-10C-54 A-10C-106 A-10F-45 A-10F-74 A-10F-105 B-40C-102 B-40F-41 B-40F-78 Improved Order-Item Table Item code ItDescUn.pric e C-1Dhal C-5Anchor C-10Tea F-4Sunlight30.00 F-7Vim98.25 F-10Lux35.00 Item Details Table SHIRAJ MOHAMED M | MIS | SEUSL 19

20 Now you will notice that all the details are simplified. So finally you will make four (4) table to store these order details in the database. The tables will be as follows Cus iDCus. Name Cus. Address 100ABCKadawatha Customer Details Table Cus iDOrder No Order Date 100A B Order Details Table SHIRAJ MOHAMED M | MIS | SEUSL 20

21 Order No Item code Qty A-10C-15 A-10C-54 A-10C-106 A-10F-45 A-10F-74 A-10F-105 B-40C-102 B-40F-41 B-40F-78 Order-Item Table Item code ItDescUn.pric e C-1Dhal C-5Anchor C-10Tea F-4Sunlight30.00 F-7Vim98.25 F-10Lux35.00 Item Details Table SHIRAJ MOHAMED M | MIS | SEUSL 21

22 EMP_PROJ EXAMPLE02 SS N PNUMHOURSENAMEPNAMELOC FD1 FD2 FD3 SHIRAJ MOHAMED M | MIS | SEUSL 22

23 SSNENAME EXAMPLE02… SSNPNUMHOURS PNUMPNAMEPLOC EP1 EP2 EP3 SHIRAJ MOHAMED M | MIS | SEUSL 23

24 EXAMPLE02… ENAMESSNBDATEADDDNUMDNAMEDMGR EMP_DEPT SHIRAJ MOHAMED M | MIS | SEUSL 24

25 ED1 ED2 EXAMPLE02… ENAMESSNBDATEADDDNUM DNAMEDMGR SHIRAJ MOHAMED M | MIS | SEUSL 25

26 Denormalization… Sometime for performance reasons, database designer may leave the relation in a lower normal form. This process is known as denormalization. DENORMALIZATION SHIRAJ MOHAMED M | MIS | SEUSL 26

27 27 SHIRAJ MOHAMED M | MIS | SEUSL End…


Download ppt "By: Shiraj Mohamed M | MIS | SEUSL SHIRAJ MOHAMED M | MIS | SEUSL 1."

Similar presentations


Ads by Google