Normalization in databases
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share
  • 3,387 views

 

Statistics

Views

Total Views
3,387
Views on SlideShare
3,387
Embed Views
0

Actions

Likes
2
Downloads
144
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Normalization in databases Presentation Transcript

  • 1. Disclaimer: This presentation is prepared by trainees ofbaabtra as a part of mentoring program. This is not officialdocument of baabtra –Mentoring PartnerBaabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .Ltd
  • 2. NORMALIZATION IN DATABASESSubhin P.V111subru@gmail.comwww.facebook.com/111subrutwitter.com/111subruin.linkedin.com/in/Subhin P.V8129076036
  • 3. MAIN POINTS DISCUSSED• What normalization is and what role it plays in thedatabase design process• About the normal forms 1NF, 2NF, 3NF and BCNF• How normal forms can be transformed from lowernormal forms to higher normal forms
  • 4. ABOUT NORMALIZATION• Normalization is the process of efficientlyorganizing data in a database.• Two goals of normalization process: Eliminating Redundant Data Ensuring data dependencies• The objective is to isolate data so that changesof a field can be made in just one table andthen propagated through the rest of thedatabase using the defined relationships.
  • 5. Normalization Stages• 1NF• 2NF• 3NF• Boyce-Codd Normal Form (BCNF or 3.5NF)
  • 6. Normalization Stages
  • 7. First Normal Form (1NF)• The values in each column of a table areatomic (No multi-value attributes allowed).• Each table has a primary key: minimal set ofattributes which can uniquely identify a record• There are no repeating groups: two columnsdo not store similar information in the sametable.
  • 8. Second Normal Form (2NF)• Meet all the requirements of the first normalform.• Remove subsets of data that apply to multiplerows of a table and place them in separatetables.• Create relationships between these newtables and their predecessors through the useof foreign keys.
  • 9. Third Normal Form (3NF)• Meet all the requirements of the secondnormal form.• Every non-prime attribute of R is non-transitively dependent (i.e. directlydependent) on every superkey of R.• Remove columns that arenot dependent upon the primary key.
  • 10. Boyce-Codd Normal Form• Meet all the requirements of the third normalform.• Every determinant must be a candidate key.• Candidate Key: Any attribute or a set of attributes together thathas the eligibility to become a primary key.
  • 11. TRANSFORMATION FROM UNF TO HIGHERNORMAL FORMS USING AN EXAMPLE• Example: Institution Having Two departments– Each Department Has 6 Different Students And SomeCourses– Each Student in a department can study more thanone Course– Each course has its course fee.– Periodically, report is generated that containsinformation displayed which can be represented in atable as shown in next slide.
  • 12. Un-normalized Form Example
  • 13. Problems With The Table– The table displays data redundancies.– The table has Multivalued Attributes– The table entries invite data inconsistencies.– The data redundancies yield the following anomalies:• Update anomalies.• Addition anomalies.• Deletion anomalies.
  • 14. Conversion to 1st Normal Form
  • 15. Conversion To 1st Normal Form– ADVANTAGES• Each table has at least one minimal set of attributeswhich can uniquely identify a record• The values in each column have Single Value– DISADVANTAGES• Redundant data across multiple rows of the table is stillthere• Existence of partial and transitive dependencies
  • 16. The Dependency diagram– Depicts all dependencies found within given tablestructure– Helpful in getting bird’s-eye view of allrelationships among table’s attributes– Makes it less likely that will overlook an importantdependency
  • 17. Conversion to 2nd Normal Form{Dep No, Dep_name}{Stud no, Stud_name, Stud_DOB, Stud_age}{Dep No, Stud No , Course_name, Course_fee}Department Details:Course Details: Student Details:
  • 18. Conversion to 2nd Normal Form• Advantages– eliminates redundant data in the table– It includes no partial dependencies:– Create separate tables for sets of values that applyto multiple records• Disadvantages– The table contains Transitive Dependencies.– Some records depend on attributes other thanthe tables primary key
  • 19. Conversion to 3rd Normal FormStudent Details:Department Details:Course Details:Student course:{Dep No, Dep_name} , {Stud no, Stud_name,Stud_DOB} , {Dep No, Stud No ,Course name} , {Course_name, Course_fee}
  • 20. Conversion to 3rd Normal Form• Advantages:– No non-key attribute depends transitively on acandidate key– All The attributes in a table Depend on a singleprimary key
  • 21. Conversion To BCNF• A Case where The table is in 3NF but not inBCNF
  • 22. Example of BCNFfd1 clientNo, interviewDate  interviewTime, staffNo, roomNo (Primary Key)fd2 staffNo, interviewDate, interviewTime clientNo (Candidate key)fd3 roomNo, interviewDate, interviewTime  clientNo, staffNo (Candidate key)fd4 staffNo, interviewDate  roomNo (not a candidate key)As a consequece the ClientInterview relation may suffer from update anomalies.For example, two tuples have to be updated if the roomNo need be changed for staffNoSG5 on the 13-May-02.ClientNo interviewDate interviewTime staffNo roomNoCR76 13-May-02 10.30 SG5 G101CR76 13-May-02 12.00 SG5 G101CR74 13-May-02 12.00 SG37 G102CR56 1-Jul-02 10.30 SG5 G102ClientInterview
  • 23. Example of BCNF(2)To transform the ClientInterview relation to BCNF, we must remove the violatingfunctional dependency by creating two new relations called Interview and SatffRoom asshown below,Interview (clientNo, interviewDate, interviewTime, staffNo)StaffRoom(staffNo, interviewDate, roomNo)ClientNo interviewDate interviewTime staffNoCR76 13-May-02 10.30 SG5CR76 13-May-02 12.00 SG5CR74 13-May-02 12.00 SG37CR56 1-Jul-02 10.30 SG5staffNo interviewDate roomNoSG5 13-May-02 G101SG37 13-May-02 G102SG5 1-Jul-02 G102InterviewStaffRoom
  • 24. THANKS
  • 25. If this presentation helped you, please visit ourpage facebook.com/baabtra and like it.Thanks in advance.www.baabtra.com | www.massbaab.com |www.baabte.com
  • 26. Contact Us