Normalization Or theoretical and common sense approaches to redesigning a database.

Slides:



Advertisements
Similar presentations
Database Design: Normalization J.G. Zheng June 29 th 2005 DB Chapter 4.
Advertisements

Normalisation to 3NF Database Systems Lecture 11 Natasha Alechina.
Boyce-Codd NF Takahiko Saito Spring 2005 CS 157A.
Normal Forms By Christopher Archibald October 16 th 2007.
Need for Normalization
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
1 5 Concepts of Database Management, 4 th Edition, Pratt & Adamski Chapter 5 Database Design: Normalization.
Normalization of Database Tables
Chapter 8 Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Introduction to Schema Refinement. Different problems may arise when converting a relation into standard form They are Data redundancy Update Anomalies.
CS 405G: Introduction to Database Systems 16. Functional Dependency.
Copyright © Curt Hill Schema Refinement III 4 th NF and 5 th NF.
This presentation prepared for MIS 421 / MBA 575 at Western Washington University. Material in this presentation drawn from Richard T. Watson, Data Management:
Avoiding Database Anomalies
NormalizationNormalization Chapter 4. Purpose of Normalization Normalization  A technique for producing a set of relations with desirable properties,
Concepts of Database Management, Fifth Edition
Database Management COP4540, SCS, FIU Relation Normalization (Chapter 14)
5 1 Chapter 5 Normalization of Database Tables Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Normalization for Relational Databases.
Lecture 6 Normalization: Advanced forms. Objectives How inference rules can identify a set of all functional dependencies for a relation. How Inference.
Database Normalization.
CSC 411/511: DBMS Design Dr. Nan Wang 1 Schema Refinement and Normal Forms Chapter 19.
M Taimoor Khan Course Objectives 1) Basic Concepts 2) Tools 3) Database architecture and design 4) Flow of data (DFDs)
Chapter 7 1 Database Principles Data Normalization Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that.
CS143 Review: Normalization Theory Q: Is it a good table design? We can start with an ER diagram or with a large relation that contain a sample of the.
Lecture 09: Functional Dependencies. Outline Functional dependencies (3.4) Rules about FDs (3.5) Design of a Relational schema (3.6)
Design Theory for Relational Databases 2015, Fall Pusan National University Ki-Joune Li.
BCNF & Lossless Decomposition Prof. Sin-Min Lee Department of Computer Science.
Normal Forms through BCNF CPSC 356 Database Ellen Walker Hiram College (Includes figures from Database Systems by Connolly & Begg, © Addison Wesley 2002)
1 5 Normalization. 2 5 Database Design Give some body of data to be represented in a database, how do we decide on a suitable logical structure for that.
By Abdul Rashid Ahmad. E.F. Codd proposed three normal forms: The first, second, and third normal forms 1NF, 2NF and 3NF are based on the functional dependencies.
1 Functional Dependencies and Normalization Chapter 15.
Functional Dependencies. Outline Functional dependencies (3.4) Rules about FDs (3.5) Design of a Relational schema (3.6)
1 Lecture 7: Normal Forms, Relational Algebra Monday, 10/15/2001.
Lecture 8: Database Concepts May 4, Outline From last lecture: creating views Normalization.
Database Design – Lecture 9 Normalization Continued.
Chapter 13 Normalization Transparencies. 2 Chapter 13 - Objectives u How to undertake process of normalization. u How to identify most commonly used normal.
1 CSE 480: Database Systems Lecture 18: Normal Forms and Normalization.
Dr. Mohamed Osman Hegaz1 Logical data base design (2) Normalization.
What is normalization ? Proposed by Codd in 1972 Takes a relation through a series of steps to certify whether it satisfies a certain normal form Initially.
Normalization. 2 u Main objective in developing a logical data model for relational database systems is to create an accurate representation of the data,
Normalization MIS335 Database Systems. Why Normalization? Optimizing database structure Removing duplications Accelerating the instructions Data integrity!
Normalization.
1 Lecture 10: Database Design Wednesday, January 26, 2005.
Functional Dependencies and Relational Schema Design.
Lecture 3 Functional Dependency and Normal Forms Prof. Sin-Min Lee Department of Computer Science.
Lecture 13: Relational Decomposition and Relational Algebra February 5 th, 2003.
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
Normalisation 1NF to 3NF Ashima Wadhwa. In This Lecture Normalisation to 3NF Data redundancy Functional dependencies Normal forms First, Second, and Third.
Chapter 8 Relational Database Design. 2 Relational Database Design: Goals n Reduce data redundancy (undesirable replication of data values) n Minimize.
11/06/97J-1 Principles of Relational Design Chapter 12.
Al-Imam University Girls Education Center Collage of Computer Science 1 nd Semester, 1432/1433H Chapter 10_part2 Functional Dependencies and Normalization.
Objectives of Normalization  To create a formal framework for analyzing relation schemas based on their keys and on the functional dependencies among.
Copyright © Curt Hill Schema Refinement II 2 nd NF to 3 rd NF to BCNF.
Database Architecture Normalization. Purpose of Normalization A technique for producing a set of relations with desirable properties, given the data requirements.
1 Lecture 9: Database Design Wednesday, January 25, 2006.
Copyright © 2016 Pearson Education, Inc. Modern Database Management 12 th Edition Jeff Hoffer, Ramesh Venkataraman, Heikki Topi CHAPTER 4: PART C LOGICAL.
Chapter 14 Functional Dependencies and Normalization Informal Design Guidelines for Relational Databases –Semantics of the Relation Attributes –Redundant.
Functional Dependencies and Normalization for Relational Databases تنبيه : شرائح العرض (Slides) هي وسيلة لتوضيح الدرس واداة من الادوات في ذلك. حيث المرجع.
Formal definition of a key A key is a set of attributes A 1,..., A n such that for any other attribute B: A 1,..., A n  B A minimal key is a set of attributes.
Lecture 11: Functional Dependencies
Normalization Refine data To attain a good DB design
Relational Design Theory
Schema Refinement What and why
Relational Design Theory
Lecture 8: Database Design
Boyce-Codd Normal Form (BCNF)
Normalisation to 3NF.
Normalization February 28, 2019 DB:Normalization.
Lecture 09: Functional Dependencies
Presentation transcript:

Normalization Or theoretical and common sense approaches to redesigning a database

References Design principles – Chapter 4 Design of Database Schemas – Chapter 3, specifically the chapters on BCNF and 3 rd normal form. Chapter posted to Canvas.

Unnormalized 1 st Normal Form 2 nd Normal Form 3 rd Normal Form BCNF Normal Form 4 th, 5 th Normal Form

1NF To be in 1 st Normal Form, a relation must have no multi-valued attributes. Each value must be atomic. See class db. This is bad because it makes it hard to query the values. Atomicity is one of the principles of good database design

Decomposition Process of taking a relation and split it into two or more equivalent relations. Must be done losslessly (no loss of data). Solving 1 NF – Remove the key and the non-atomic field and make a new relation keyed on key and the individual key values. – Make multiple fields to hold the non-atomic values (just as bad). – Flatten the table making a row for each individual value.

1NF In some references, a Relation violates 1NF if there are repeating groups. See courses in our class db. So the first solution would continue to violate 1NF. It just shifts the problem. But we still have a problem.

2NF A relation is in 2NF if it is already in 1NF and it has not partial dependency on the key. – R(A, B, C, D, E, F) – AB -> C, D, E, F – A -> D – B -> E – D and E are only partially dependent on the key.

Solving 2NF Remove the partial dependency to a new table. New tables – R(A, B, C, F) – S(A, D) – T(B, E) Note: A table in 1NF that has a single key component is also in 2NF. R(A, B, C, D, E, F) AB -> C, D, E, F A -> D B -> E D and E are only partially dependent on the key.

3NF A table is in 3NF if it is in 2NF and it has no transitive dependencies. – R(A, B, C, D, E) – A, B -> C, D, E – D -> E E is transitively dependent on D

Solving for 3NF Copy the transitive determinate to a new table and remove the dependent attribute. R(A, B, C, D) S(D, E) R(A, B, C, D, E) A, B -> C, D, E D -> E

BCNF A relation R is in BCNF if and only if whenever there is a nontrivial FD {A1, A2, … An} -> {B1, B2, … Bn} for R, it is the case that {A1, A2, … An} is a superkey for R. Often relations that are not in BCNF are also not in 3 rd normal or 2 nd normal form.

BCNF Continued A relation in 3NF is not in BCNF if: – The candidate keys are composite keys – there is more than one candidate key in the relation – the keys are not disjoint (in other words, they have some attributes in common). Or to put it another way, all determinants are candidate keys

Example From Modern Database Management (Hoffer, Ramesh, Tofi) – SID, Major -> Advisor, MajGPA – Advisor -> Major Anomaly can occur when we need to change the advisor. Not every determinant (advisor) is a superkey to the relation SIDMajorAdvisorMajGPA 123PhysicsHawking MusicMahler LiteratureMichener MusicBach PhysicsHawking3.5

Decomposition R(SID, Advisor, MajGPA) S(Advisor, Major) Note: if you have to change the advisor, you still have to change it in multiple places.