INLS 623 – Database Normalization

Slides:



Advertisements
Similar presentations
Chapter 5 Normalization of Database Tables
Advertisements

Normalization What is it?
Normalisation The theory of Relational Database Design.
INLS 623 – D ATABASE N ORMALIZATION Instructor: Jason Carter.
Normalisation Ensuring data integrity in database design 1.
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
Boyce-Codd Normal Form Kelvin Nishikawa SE157a-03 Fall 2006 Kelvin Nishikawa SE157a-03 Fall 2006.
The Relational Database Model:
Chapter 5 Normalization of Database Tables
Normalization A337. A337 - Reed Smith2 Structure What is a database? ◦ Tables of information  Rows are referred to as records  Columns are referred.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 5 Normalization of Database Tables.
NORMALIZATION N. HARIKA (CSC).
Introduction to Schema Refinement. Different problems may arise when converting a relation into standard form They are Data redundancy Update Anomalies.
Chapter 5 Normalization of Database Tables
XP Chapter 1 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Level 3 Objectives: Identifying and Eliminating Database.
Database Requires Normalization
Avoiding Database Anomalies
RDBMS Concepts/ Session 3 / 1 of 22 Objectives  In this lesson, you will learn to:  Describe data redundancy  Describe the first, second, and third.
5 1 Chapter 5 Normalization of Database Tables Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
A Normalisation Example Mark Kelly McKinnon Secondary College Vceit.com Based on work by Robert Timmer-Arends.
Module III: The Normal Forms. Edgar F. Codd first proposed the process of normalization and what came to be known as the 1st normal form. The database.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 5 Normalization of Database.
Normalization of Data  Relatively easy examples from –Discussion –1 st Normal Form –2 nd Normal Form –3 rd Normal Form.
SALINI SUDESH. Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that avoid unnecessary duplication of.
M Taimoor Khan Course Objectives 1) Basic Concepts 2) Tools 3) Database architecture and design 4) Flow of data (DFDs)
Unit 4 Object Relational Modeling. Key Concepts Object-Relational Modeling outcomes and process Relational data model Normalization Anomalies Functional.
11/07/2003Akbar Mokhtarani (LBNL)1 Normalization of Relational Tables Akbar Mokhtarani LBNL (HENPC group) November 7, 2003.
Database Design – Lecture 8
Normalization of Database Tables
A337 - Reed Smith1 Structure What is a database? –Table of information Rows are referred to as records Columns are referred to as fields Record identifier.
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.
Normalisation RELATIONAL DATABASES.  Last week we looked at elements of designing a database and the generation of an ERD  As part of the design and.
NORMALIZATION. What is Normalization  The process of effectively organizing data in a database  Two goals  To eliminate redundant data  Ensure data.
Normalisation 1NF to 3NF Ashima Wadhwa. In This Lecture Normalisation to 3NF Data redundancy Functional dependencies Normal forms First, Second, and Third.
Chapter 8: Object-Relational Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A. Hoffer.
NormalisationNormalisation Normalization is the technique of organizing data elements into records. Normalization is the technique of organizing data elements.
Normalization ACSC 425 Database Management Systems.
Database Architecture Normalization. Purpose of Normalization A technique for producing a set of relations with desirable properties, given the data requirements.
NORMALIZATION Handout - 4 DBMS. What is Normalization? The process of grouping data elements into tables in a way that simplifies retrieval, reduces data.
5 1 Chapter 5 Normalization of Database Tables Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
SLIDE 1IS 257 – Fall 2006 Normalization Normalization theory is based on the observation that relations with certain properties are more effective.
INLS 623 – D ATABASE N ORMALIZATION Instructor: Jason Carter.
Lecture # 17 Chapter # 10 Normalization Database Systems.
Normalisation FORM RULES 1NF 2NF 3NF. What is normalisation of data? The process of Normalisation organises your database to: Reduce or minimise redundant.
Normalizing Database Designs. 2 Objectives In this chapter, students will learn: –What normalization is and what role it plays in the database design.
Chapter 8: Object-Relational Modeling
COP 6726: New Directions in Database Systems
Database, tables and normal forms
Revised: 2 April 2004 Fred Swartz
A brief summary of database normalization
Functional Dependencies
Normalization DBS201.
Database Normalization
Normalization Murali Mani.
Normalization By Jason Park Fall 2005 CS157A.
Functional Dependencies and Normalization
Normalization A337.
1st, 2nd, and 3rd Normal Forms
INFS 3220 Systems Analysis & Design
Normalization.
Database Design Agenda
1st, 2nd, and 3rd Normal Forms
Introduction to Database Design
2. Problem Without Normalization
Normalization.
Database Normalization.
Normalization By Jason Park Fall 2005 CS157A.
Review of Week 3 Relation Transforming ERD into Relations
Normalization DBS201.
Lecture 09: Functional Dependencies
Presentation transcript:

INLS 623 – Database Normalization Instructor: Jason Carter

Set Theory Set What does set theory have to do with databases? A collection of zero or more distinct objects. What does set theory have to do with databases? A record is a set of attribute/property values Columns are a set of attributes Rows are a set of records Conventionally sets are denoted with capital letters A = {1,2,3} B = {2,1,5} C = {red, green, blue}

Sets Equality Membership {6, 11} = {11, 6} = {11, 6, 6, 11} . {1,2} = {2,1} Membership A = {1,2,3,4} ∈ = member of 4 ∈ A, 1 ∈ A, 3 ∈ A, 2 ∈ A  ∉ = not a member of 6  ∉ A

Sets Subsets a set A is a subset of a set B if all members of set A is also a member of set B ⊆ = subset A = {1,3} B = {1,2,3,4} {1, 3} ⊆ {1, 2, 3, 4} A ⊆ B

Sets Superset a set B is a superset of a set A if all members of set A are members of set B ⊋ = superset A = {1,3} B = {1,2,3,4} {1, 2, 3, 4} ⊋ {1, 3} B ⊋ A

Terminology

What is Normalization? A technique to organize “efficiently” organize data in a database “Efficiently”: Eliminating redundant data Not storing the same data in more than one table Ensuring that functional dependencies make sense Database normalization, or data normalization, is a technique to organize the contents of the tables for transactional databases and data warehouses. Normalization is part of successful database design; without normalization, database systems can be inaccurate, slow, and inefficient, and they might not produce the data you expect.

Without Normalization student_id name address subject 401 Adam 133 Our Lane Biology 402 Alex 123 Here Lane Math 403 Stuart 123 My Lane 404 123 Their Lane Physics Update Anomaly : To update address of a student who occurs twice or more than twice in a table, we will have to update address column in all the rows, else data will become inconsistent. Insertion Anomaly : Suppose for a new admission, we have a Student id(S_id), name and address of a student but if student has not opted for any subjects yet then we have to insert NULL there, leading to Insertion Anamoly. Deletion Anomaly : If (student_id) 401 has only one subject and temporarily he drops it, when we delete that row, entire student record will be deleted along with it.

Normal Form 1st Normal Form 2nd Normal Form 3rd Normal Form Boyce-Codd Normal Form  (3.5 Normal Form) 4th Normal Form

1st Normal Form Every cell in the table is atomic No repeating groups A cell value cannot be divided further Seen differently – there are no grouping of information inside a cell. No repeating groups Eliminate duplicative columns from the same table. Create separate tables for each group of related data and identify each row with a unique column or set of columns (the primary key).

1st Normal Form Does this table violate first normal form? Student Id First name Last name Grades Classes 1 Bob Wood C,B 401, 623 2 Joe Smith A,D 550, 823 3 Alice Boone A,A 890,991 4 Shelly Kent A,B 770,881 Does this table violate first normal form?

1st Normal Form Student Id First name Last name Grades Classes 1 Bob Wood C,B 401, 623 2 Joe Smith A,D 550, 823 3 Alice Boone A,A 890,991 4 Shelly Kent A,B 770,881 Grades and Classes have multiple rows of data in one column

1st Normal Form Create new rows Student Id First name Last name Grades Classes 1 Bob Wood C 401 2 Joe Smith A 550 3 Alice Boone 890 4 Shelly Kent 770 5 B 623 6 D 823 7 991 8 881 Create new rows

2nd Normal Form Table must be in 1st Normal Form If the primary key is a composite of attributes (contains multiple columns), the non key attributes (columns) must depend on the whole key. 2nd Normal Form Table must be in 1st Normal Form If the primary key is a composite of attributes (contains multiple columns), the non key attributes (columns) must depend on the whole key.

Functional Dependencies A functional dependency is a relationship between or among attributes in a table. One attribute is functionally dependent on another if the value of the second attribute determines the value of the first attribute. If you know the value of the second attribute, you can determine the value of the first attribute. Total Charge = StandardCharge * NumberOfTests

2nd NF: Functional Dependencies Examples SSN (PK) First Name Last Name Age 343-33333 Jack Doe 21 398-34533 Jane 25 500-33333 Jill Roy 32 700-33333 50 SSN → Age SSN → FN SSN → LN

2nd NF: Functional Dependencies Examples Customer_ID Product Price 100 Cell Phone 295.00 101 Wallet 25.00 Toothpaste 5.99 Jeans 49.99 What is the primary key? Customer_ID, Product

2nd NF: Functional Dependencies Examples All attributes must depend on the whole key (Customer_ID + Product). Is this table in 2nd NF? Customer_ID (PK) Product Price 100 Cell Phone 295.00 101 Wallet 25.00 Toothpaste 5.99 Jeans 49.99

2nd NF: Functional Dependencies Examples Customer_ID (PK) Product (FK) 100 Cell Phone 101 Wallet Toothpaste Jeans Product (PK) Price Cell Phone 295.00 Wallet 25.00 Toothpaste 5.99 Jeans 49.99

2nd NF: Functional Dependencies Examples First Ten Customers get a discount off the normal price Is this table in 2nd NF? Customer_ID (PK) Product Price 100 Cell Phone 295.00 101 Wallet 25.00 Toothpaste 5.99 Jeans 49.99

2nd NF: Functional Dependencies Examples YES Customer_ID (PK) Product Price 100 Cell Phone 295.00 101 Wallet 25.00 Toothpaste 5.99 Jeans 49.99 Price depends on the Customer_ID and Product

3rd Normal Form Table must be in 2nd Normal Form A table is in 3NF if: Table has no transitive dependencies.

Transitive Dependency One attribute (column) depends on a second attribute, which depends on a third attribute A non-key column that rely on another non-key attributes, and not the primary key.

3rd NF: Transitive Dependency Only one for each CustomerID Customer # (PK) Product Price 100 Cell Phone 295.00 102 Wallet 25.00 103 Toothpaste 5.99 104 Jeans 49.99 Customer 102 is unhappy with his wallet and wants to return it. What do you do?

3rd NF: Transitive Dependency Want to remove the second row Customer_ID (PK) Product Price 100 Cell Phone 295.00 103 Toothpaste 5.99 104 Jeans 49.99 You lose the fact that a wallet cost $25. Price depends on Product, Product depends on Customer_ID

3rd NF: Transitive Dependency Customer_ID (PK) Product (FK) 100 Cell Phone 101 Wallet Toothpaste Jeans Product (PK) Price Cell Phone 295.00 Wallet 25.00 Toothpaste 5.99 Jeans 49.99