Chapter 5: Normalizing the DB. What to do with a bad database structure? How do we determine the right structure? How do we determine primary keys? Normalization.

Slides:



Advertisements
Similar presentations
Normalisation.
Advertisements

Chapter 5 Normalization of Database Tables
5 5 Normalization of Database Tables Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Chapter 5 Normalization of Database Tables
Relational Terminology. Normalization A method where data items are grouped together to better accommodate business changes Provides a method for representing.
Logical Data Modeling Review Lecture for University of Agder, Grimstad DAT202 Databaser (5.5.11) Judith Molka-Danielsen
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.
1 5 Concepts of Database Management, 4 th Edition, Pratt & Adamski Chapter 5 Database Design: Normalization.
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.
1 5 Concepts of Database Management, 4 th Edition, Pratt & Adamski Chapter 5 Database Design 1: Normalization.
SQL (Standard Query Language) Yong Choi School of Business CSU, Bakersfield.
Chapter 3: SQL – Part I Yong Choi School of Business CSU, Bakersfield.
Database – Part 2a Dr. V.T. Raja Oregon State University.
Part ( PartNum, Description, OnHand, Class, Warehouse, Price,
SQL – Part I Yong Choi School of Business CSU, Bakersfield.
Daniel AdinugrohoDatabase Programming 1 DATABASE PROGRAMMING Lecture on 29 – 04 – 2005.
Chapter 4: Logical Database Design and the Relational Model (Part II)
DBSQL 4-1 Copyright © Genetic Computer School 2009 Chapter 4 Database Design.
XP Chapter 1 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Level 3 Objectives: Identifying and Eliminating Database.
Introduction to SQL Yong Choi School of Business CSU, Bakersfield.
Lecture 12 Inst: Haya Sammaneh
A Guide to SQL, Eighth Edition Chapter Two Database Design Fundamentals.
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
Normalization A technique that organizes data attributes (or fields) such that they are grouped to form stable, flexible and adaptive entities.
RDBMS Concepts/ Session 3 / 1 of 22 Objectives  In this lesson, you will learn to:  Describe data redundancy  Describe the first, second, and third.
Concepts of Database Management Sixth Edition Chapter 5 Database Design 1: Normalization.
Concepts of Database Management, Fifth Edition
Chapter 4 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
1 A Guide to MySQL 2 Database Design Fundamentals.
Normalization. We will take a look at –First Normal Form –Second Normal Form –Third Normal Form There are also –Boyce-Codd, Fourth and Fifth normal forms.
資料庫正規化 Database Normalization 取材自 AIS, 6 th edition By Gelinas et al.
SALINI SUDESH. Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that avoid unnecessary duplication of.
Chapter 7 1 Database Principles Data Normalization Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that.
CORE 2: Information systems and Databases NORMALISING DATABASES.
Normalization of Database Lecture - ANS Yong Choi School of Business CSUB.
SQL – Part I Yong Choi School of Business CSU, Bakersfield.
Data Models and Relational Databases Chapter 2. Learning Objectives Identify primary and foreign keys for each entity and relevant relationships in the.
Normalization Information Systems II Ioan Despi. Informal approach Building a database structure : A process of examining the data which is useful & necessary.
1 A Guide to MySQL 2 Database Design Fundamentals.
Customer Order Order Number Date Cust ID Last Name First Name State Amount Tax Rate Product 1 ID Product 1 Description Product 1 Quantity Product 2 ID.
CIS 210 Systems Analysis and Development Week 6 Part II Designing Databases,
Unit 4 Object Relational Modeling. Key Concepts Object-Relational Modeling outcomes and process Relational data model Normalization Anomalies Functional.
SQL – Part I Yong Choi School of Business CSU, Bakersfield.
ITN Table Normalization1 ITN 170 MySQL Database Programming Lecture 3 :Database Analysis and Design (III) Normalization.
Normalization Transparencies 1. ©Pearson Education 2009 Objectives How the technique of normalization is used in database design. How tables that contain.
In this session, you will learn to: Describe data redundancy Describe the first, second, and third normal forms Describe the Boyce-Codd Normal Form Appreciate.
Chapter 4 Normalization of Database Tables. 2 Database Tables and Normalization Table is basic building block in database design Table is basic building.
Concepts of Database Management Seventh Edition Chapter 5 Database Design 1: Normalization.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Normalization Hour1,2 Presented & Modified by Mahmoud Rafeek Alfarra.
8-1 © Prentice Hall, 2007 Chapter 8: Object-Relational Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
Microsoft Access 2010 Chapter 11 Database Design.
Week 4 Lecture Part 1 of 3 Normalization of Database Tables Samuel ConnSamuel Conn, Asst. Professor.
Southern Methodist University CSE CSE 2337 Introduction to Data Management Chapter 5 Part II.
Normalization ACSC 425 Database Management Systems.
NORMALIZATION Handout - 4 DBMS. What is Normalization? The process of grouping data elements into tables in a way that simplifies retrieval, reduces data.
Decomposition and Normalization Fan Qi
Normalisation FORM RULES 1NF 2NF 3NF. What is normalisation of data? The process of Normalisation organises your database to: Reduce or minimise redundant.
Relational Databases – Further Study I think we’ve covered all you need to know for GCSE about relational databases I’m not aware of any practical coursework.
A Guide to SQL, Eighth Edition
Revised: 2 April 2004 Fred Swartz
Database Normalization
Chapter 11 Database Design
Concepts of Database Management Eighth Edition
Normalization Referential Integrity
Normalization – Part II
Chapter 14 Normalization Pearson Education © 2009.
BTEC ICT – Unit 18 With Mr Griffiths.
Presentation transcript:

Chapter 5: Normalizing the DB

What to do with a bad database structure? How do we determine the right structure? How do we determine primary keys? Normalization Rules.

Functional Dependence –When the values of one column depend on the values of another column –Column A determines Col B, then B is dependent on A. –If all the columns are dependent on A, then A is most likely a primary key.

RepNumLastNameFirstNameStreetCityStateZipCommissionPayClassRate 20KaiserValerie624 Randall GroveFL , HullRichard525 Jackson SheldonFL , PerezJuan1626 Taylor FillmoreFL , We’ve added a new field – Pay Class, which determines the rate. Rate is dependent on Pay Class. What other dependencies are there?

OrderNumOrderDateCustomerNum /20/ /20/ /21/ /21/ Orders Table The order number determines the date, and the customer number. They are dependent on the order number. The order number isn’t dependent on anything.

OrderNumPartNumNumOrderedQuotedPrice 21608AT DR DW DR What does the NumOrdered column depend on? What field(s) determine the quoted price?

1 st Normal Form: –Tables without repeating groups Break the repeating groups into individual rows to have 1 st Normal form.

Second Normal Form OrderNumOrderDatePartNumDescriptionNumOrderedQuotedPrice /20/2008AT94Iron /20/2008DR93Gase Range /20/2008DW11Washer /20/2008Kl62Dryer /23/2008DR93Gas Range What is wrong with this table structure? It is in 1NF, but not in 2NF.

The redundant data leads to serious problems. –Updating –Possibility of inconsistent data –Problem of making additions –Problem of deleting What is the primary key for that table? What does description depend on?

Third Normal Form CustomerNum CustomerName BalanceCreditLimitRepNumLastNameFirstName 148Al’s Appliance & Sport $6,550$7,50020KaiserValerie 282Brookings Direct $435$10,00035HullRichard 356Ferguson’s$ $7,50065PerezJuan 462Bargain’s Galore $3,412$10,00065PerezJuan CustomerNum determines everything. It’s the primary key. But there is still a problem… To get this table into 3NF, we need to break out the redundant data.

Fourth Normal Form FacultyNumStudentNumCommitteeCode ADV HSG PER HSG CUR If we redesigned this structure to this:

FacultyNumStudentNumCommitteeCode ADV HSG PER ADV HSG PER HSG CUR CUR This table is in 3NF, but what’s the problem here?

The table tries to group together 3 entities that really shouldn’t be grouped. They aren’t exactly related. What primary key column would determine the other column? It should be: FacStudent (FacultyNum, StudentNum) FacCommittee (FacultyNum, CommitteeCode)