Texas State Technical College DISCOVER! Second Normal Form - 2NF It has to be the whole key.

Slides:



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

Designing MS-Access Tables
Chapter 5 Normalization of Database Tables
Chapter 6 Advanced Data Modelling
Normalisation Ensuring data integrity in database design 1.
DBS201: Introduction to Normalization
Client/Server Databases and the Oracle 10g Relational Database
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
1 NORMALISATION. 2 Introduction Overview Objectives Intro. to Subject Why we normalise 1, 2 & 3 NF Normalisation Process Example Summary.
Project and Data Management Software
System Analysis and Design
Mapping ERM to relational database
Chapter 5 Normalization of Database Tables
Normalization. Introduction Badly structured tables, that contains redundant data, may suffer from Update anomalies : Insertions Deletions Modification.
CREATE THE DIFFERENCE Normalisation (special thanks to Janet Francis for this presentation)
A Guide to SQL, Eighth Edition Chapter Two Database Design Fundamentals.
Chapter 1 Overview of Database Concepts Oracle 10g: SQL
1 Chapter 1 Overview of Database Concepts. 2 Chapter Objectives Identify the purpose of a database management system (DBMS) Distinguish a field from a.
Exploring Microsoft Access Chapter 4 Relational Databases, External Data, Charts, and the Switchboard.
Lecture 2 An Overview of Relational Database IST 318 – DB Admin.
Avoiding Database Anomalies
Normalization - Mr. Ahmad Al-Ghoul Data Design. 2 learning Objectives  Explain the concept of table design  Explain unnormalized design and the first.
Normalization A technique that organizes data attributes (or fields) such that they are grouped to form stable, flexible and adaptive entities.
Database Systems: Design, Implementation, and Management Tenth Edition
Module Title? DBMS Normalization. Module Title? DBMS Normalization  Normalization is the process of removing redundant data from tables in order to improve.
RDBMS Concepts/ Session 3 / 1 of 22 Objectives  In this lesson, you will learn to:  Describe data redundancy  Describe the first, second, and third.
Database Systems: Design, Implementation, and Management Ninth Edition Chapter 6 Normalization of Database Tables.
1 A Guide to MySQL 2 Database Design Fundamentals.
Concepts of Relational Databases. Fundamental Concepts Relational data model – A data model representing data in the form of tables Relations – A 2-dimensional.
Logical Database Design Relational Model. Logical Database Design Logical database design: process of transforming conceptual data model into a logical.
In this chapter, you learn about the following: ❑ Anomalies ❑ Dependency and determinants ❑ Normalization ❑ A layman’s method of understanding normalization.
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.
BIS 360 – Lecture Eight Ch. 12: Database Design and Normalization.
Chapter 1Introduction to Oracle9i: SQL1 Chapter 1 Overview of Database Concepts.
5. Database Design Lingma Acheson Department of Computer and Information Science IUPUI CSCI N207 Data Analysis Using Spreadsheets 1.
CIS 210 Systems Analysis and Development Week 6 Part II Designing Databases,
Texas State Technical College DISCOVER! Inner Joins Let’s get together… yeah yeah yeah!
3 & 4 1 Chapters 3 and 4 Drawing ERDs October 16, 2006 Week 3.
ITN Table Normalization1 ITN 170 MySQL Database Programming Lecture 3 :Database Analysis and Design (III) Normalization.
Database Design – Lecture 8
1 5 Chapter 5 Database Design 1: Some Normalization Examples Spring 2006.
RDBMS MySQL. MySQL is a Relational Database Management System MySQL allows multiple tables to be related to each other. Similar to a Grandparent to a.
Texas State Technical College DISCOVER! Cartesian Product Cover all the bases.
Normalization Data Design - Mr. Ahmad Al-Ghoul
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.
Texas State Technical College DISCOVER! Modeling the Real World Its all about perspective.
BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.
Understand Relational Database Management Systems Software Development Fundamentals LESSON 6.1.
Postgresql East Philadelphia, PA Databases – A Historical Perspective.
Databases Database Normalisation. Learning Objectives Design simple relational databases to the third normal form (3NF).
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.
Texas State Technical College DISCOVER! Third Normal Form - 3NF It’s all about the key, the whole key, and nothing but the key.
Logical Database Design and Relational Data Model Muhammad Nasir
What Is Normalization  In relational database design, the process of organizing data to minimize redundancy  Usually involves dividing a database into.
Normalizing Database Designs. 2 Objectives In this chapter, students will learn: –What normalization is and what role it plays in the database design.
Understanding Data Storage
Database, tables and normal forms
SEEM3430: Information Systems Analysis and Design
A brief summary of database normalization
Relational Databases.
Normalization Referential Integrity
Normalization and Databases
Chapter 4.1 V3.0 Napier University Dr Gordon Russell
Relational Database Model
Primary key Introduction Introduction: A primary key, also called a primary keyword, is a key in a relational database that is unique for each record.
Database Normalisation
Chapter 8 – Part2 Database Design.
Normalisation 1 Unit 3.1 Dr Gordon Russell, Napier University
Presentation transcript:

Texas State Technical College DISCOVER! Second Normal Form - 2NF It has to be the whole key.

Texas State Technical College DISCOVER! Second Normal Form (2NF) 2NF is an extension to 1NF that increases the organization in the database. A database is 2NF when all of the contained tables are 2NF. The focus of 2NF is to eliminate partial dependencies on primary keys. A table that is 1NF and uses a singular primary key is automatically 2NF. Overview

Texas State Technical College DISCOVER! In order for a table to be considered 2NF Must be 1NFMust be 1NF All fields should be dependent or related to the whole primary keyAll fields should be dependent or related to the whole primary key If a composite primary key is used, there must not be a field that is only related to a portion of the primary keyIf a composite primary key is used, there must not be a field that is only related to a portion of the primary key The Technical Definition Second Normal Form (2NF)

Texas State Technical College DISCOVER! In order for a table to be considered 2NF No repeating groups (1NF)No repeating groups (1NF) All fields must be directly related to the entire primary key.All fields must be directly related to the entire primary key. Tables that utilize a singular primary key are automatically 2NF, provided that they are 1NF.Tables that utilize a singular primary key are automatically 2NF, provided that they are 1NF. The Layman’s Definition Second Normal Form (2NF)

Texas State Technical College DISCOVER! Are known as composite primary keys and can be problematic. It is a primary key that is composed of two or more fields. It is very common that fields in a composite key are also foreign keys. These fields are both foreign keys and partial primary keys. Non-Singular Primary Keys Second Normal Form (2NF)

Texas State Technical College DISCOVER! Sometimes their use is more logical than creating a new primary key. Sometimes values in fields produce a unique identifier when combined that is more useful than a random or sequential number. For Example Name + Date is easier to remember and use as a primary key than an automatically generated 10 digit number. John-Davis-14may07 VS Why Use Composite Primary Keys? Second Normal Form (2NF)

Texas State Technical College DISCOVER! Composite primary keys are the source of the problem that requires normalization to 2NF. Only tables with composite primary keys have to be converted to 2NF. Avoiding the use of composite keys avoids the problems Linking a foreign key to two or more fieldsLinking a foreign key to two or more fields Having to guarantee a database is 2NFHaving to guarantee a database is 2NF It can be summed up as It’s about the key, the whole key. 2NF Second Normal Form (2NF)

Texas State Technical College DISCOVER! In the example below, the table is not 2NF because it contains partial dependencies. For Example… [ DMV ] Registration SSN pk/fk VIN pk/fk Registered pk ExpiresCountyMfgMake Text Date Text A Jan-0213-Jan-03TaylorFordFocus RTE78625-Mar-0624-Mar-07JonesDodgeNeon QW Oct-0026-Oct-01TaylorFordMustang TS Nov-0410-Nov-05CallahanKiaSpectra Problem: Partial dependencies upon the primary key. Second Normal Form (2NF)

Texas State Technical College DISCOVER! Let’s verbalize the relationships. For Example… [ DMV ] Registration SSN pk/fk VIN pk/fk Registered pk ExpiresCountyMfgMake A Registration is the ownership by a person SSN for a vehicle VIN created on date Registered. SSN, VIN, and Registered are the unique identifier for a registration. Expires defines the date of expiration for a registration. The county describes the geographical locale for a registration. Mfg describes the manufacturer of the vehicle in the registration. Make describes the model of the vehicle in the registration Second Normal Form (2NF)

Texas State Technical College DISCOVER! From verbalizing we can see… For Example… [ DMV ] Registration SSN pk/fk VIN pk/fk Registered pk ExpiresCountyMfgMake SSN, VIN, and Registered are the fields that compose the primary key, thus it is a composite primary key. Expires and County refer to the whole primary key as they apply to the whole concept of a registration. Mfg and Make are partially dependent upon the primary key because they only describe the vehicle represented by VIN. Second Normal Form (2NF)

Texas State Technical College DISCOVER! 1.For each portion of a composite primary key, identify all the partially dependent fields. Find all the fields that are partially dependent upon the same key field. 2.If the key field is also a foreign key, synchronize the two tables and remove the partially dependent fields. Guarantee that the fields and their information are in the parent table, then remove them from the child table. 3.If the key field is not a foreign key, make it one and remove the partially dependent fields. Create a table for the object, move the partially dependent fields and data to the new table, and remove them from the child table. 4.Repeat the process until database is 2NF. The database is 2NF when all tables in the database are 2NF. Converting to 2NF Second Normal Form (2NF)

Texas State Technical College DISCOVER! Step One: Identify partially dependent fields. SSN has no partially dependent fields.SSN has no partially dependent fields. VIN has two partially dependent fields.VIN has two partially dependent fields. MfgMfg MakeMake Registered has no partially dependent fields.Registered has no partially dependent fields. For Example… [ DMV ] Registration SSN pk/fk VIN pk/fk Registered pk ExpiresCountyMfgMake Text Date Text Problem: Partial dependencies upon the primary key. Second Normal Form (2NF)

Texas State Technical College DISCOVER! Step Two: Move partially dependent fields. In this case, we guarantee that there is a vehicle table that contains Mfg and Make.In this case, we guarantee that there is a vehicle table that contains Mfg and Make. If not, we create the table and make VIN a foreign key linking the two.If not, we create the table and make VIN a foreign key linking the two. For Example… [ DMV ] Registration SSN pk/fk VIN pk/fk Registered pk ExpiresCounty Text Date Text Vehicle VIN pk MfgMake Text FIXED: The table is now 2NF! Second Normal Form (2NF)

Texas State Technical College DISCOVER! In Summary… Second normal form (2NF) dictates that all fields in a table must be wholly related to the primary key.Second normal form (2NF) dictates that all fields in a table must be wholly related to the primary key. A table must be 1NF before it can be 2NF.A table must be 1NF before it can be 2NF. Tables that are 1NF and do not use composite primary keys are automatically 2NF.Tables that are 1NF and do not use composite primary keys are automatically 2NF. Second Normal Form (2NF)