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-1010.4.09C-1Dhal125.005 100ABCKadawathaA-1010.4.09C-5Anchor250.004 100ABCKadawathaA-1010.4.09C-10Tea140.006 100ABCKadawathaA-10104.09F-4Sunlight30.005 100ABCKadawathaA-1010.4.09F-7Vim98.254 100ABCKadawathaA-1010.4.09F-10Lux35.005 100ABCKadawathaB-4001.5.09C-10Tea140.002 100ABCKadawathaB-4001.5.09F-4Sunlight30.001 100ABCKadawathaB-4001.5.09F-7Vim98.258 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-1010.4.11C-1Dhal125.005 100A-1010.4.11C-5Anchor250.004 100A-1010.4.11C-10Tea140.006 100A-10104.11F-4Sunlight30.005 100A-1010.4.11F-7Vim98.254 100A-1010.4.11F-10Lux35.005 100B-4001.5.11C-10Tea140.002 100B-4001.5.11F-4Sunlight30.001 100B-4001.5.11F-7Vim98.258 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-1010.4.09 100B-401.5.09 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-1Dhal125.005 A-10C-5Anchor250.004 A-10C-10Tea140.006 A-10F-4Sunlight30.005 A-10F-7Vim98.254 A-10F-10Lux35.005 B-40C-10Tea140.002 B-40F-4Sunlight30.001 B-40F-7Vim98.258 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-1Dhal125.00 C-5Anchor250.00 C-10Tea140.00 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-1010.4.09 100B-401.5.09 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-1Dhal125.00 C-5Anchor250.00 C-10Tea140.00 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