Normalizing an Existing Table

Slides:



Advertisements
Similar presentations
5 5 Normalization of Database Tables Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Advertisements

Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
Normalization I.
Normalization A337. A337 - Reed Smith2 Structure What is a database? ◦ Tables of information  Rows are referred to as records  Columns are referred.
Introduction to Schema Refinement. Different problems may arise when converting a relation into standard form They are Data redundancy Update Anomalies.
Normalization. Introduction Badly structured tables, that contains redundant data, may suffer from Update anomalies : Insertions Deletions Modification.
Lecture 12 Inst: Haya Sammaneh
Normalization. 2 Objectives u Purpose of normalization. u Problems associated with redundant data. u Identification of various types of update anomalies.
Module Title? DBMS Normalization. Module Title? DBMS Normalization  Normalization is the process of removing redundant data from tables in order to improve.
Normalization (Codd, 1972) Practical Information For Real World Database Design.
Normalization Transparencies
Chapter 10 Normalization Pearson Education © 2009.
Database Design – Lecture 8
Normalization Transparencies 1. ©Pearson Education 2009 Objectives How the technique of normalization is used in database design. How tables that contain.
Normalization. 2 u Main objective in developing a logical data model for relational database systems is to create an accurate representation of the data,
Normalizing Database Files Professor Ralph Westfall May, 2011.
Importing Data from a Spreadsheet If you came to this presentation via a web browser, right-click and choose “Full Screen” before proceeding. Click mouse.
Data modeling Process. Copyright © CIST 2 Definition What is data modeling? –Identify the real world data that must be stored on the database –Design.
Microsoft Access 2010 Chapter 11 Database Design.
Normalization. Overview Earliest  formalized database design technique and at one time was the starting point for logical database design. Today  is.
XP Chapter 1 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Level 2 Objectives: Understanding and Creating Table.
Systems Analysis & Design Methods III Classic normalization rules for relational databases III Classic normalization rules for relational databases.
1 CS490 Database Management Systems. 2 CS490 Database Normalization.
DBM 380 AID Focus Dreams/dbm380aid.com
CSIS 115 Database Design and Applications for Business
Normalization.
Tables & Relationships
Relational Model.
Unary Many-to-Many Relationship
The Relational Model and Database Normalization
David M. Kroenke and David J
The Relational Model Chapter Two DATABASE CONCEPTS, 3rd Edition
Chapter 2: Relational Model
A brief summary of database normalization
DBM 380 aid Education Begins/dbm380aid.com
CSIS 115 Database Design and Applications for Business
MIS 322 – Enterprise Business Process Analysis
Functional Dependencies
CIS 155 Table Relationship
Design a Relational Database Identify Database Purpose
Lecture # 13 (After 1st Exam)
Database Normalization
CIS 336 Competitive Success/snaptutorial.com
CIS 336 Education for Service-- snaptutorial.com.
CIS 336 Teaching Effectively-- snaptutorial.com
Chapter 11 Database Design
Chapter 9 Designing Databases
Entity Relationships and Normalization
Relational Model and ER Model: in a Nutshell
© 2011 Pearson Education, Inc. Publishing as Prentice Hall
Normalization of Database Tables PRESENTED BY TANVEERA AKHTER FOR BCA 2ND YEAR dated:15/09/2015 DEPT. OF COMPUTER SCIENCE.
Teaching slides Chapter 8.
Normalization A337.
בסיסי נתונים - מצגת ההרצאה - 1.
Database solutions The process of normalization Marzena Nowakowska Faculty of Management and Computer Modelling Kielce University of Technology rooms:
Normalization Dale-Marie Wilson, Ph.D..
CS122 Using Relational Databases and SQL
Data Management Innovations 2017 High level overview of DB
Creating and Managing Database Tables
國立臺北科技大學 課程:資料庫系統 2015 fall Chapter 14 Normalization.
Relational Database Design
CS1222 Using Relational Databases and SQL
Logical Data Modeling – Normalization
Design tools and techniques for a relational database system
Chapter 8 Database Redesign
Review of Week 3 Relation Transforming ERD into Relations
CS122 Using Relational Databases and SQL
Shelly Cashman: Microsoft Access 2016
BTEC ICT – Unit 18 With Mr Griffiths.
Database.
Presentation transcript:

Normalizing an Existing Table MigratingData 8/28/2018 Normalizing an Existing Table Migrating Data from a Single Table to Multiple Tables Or How can I smoothly convert my 1NF data into multiple tables? Note: on the following slides, you will see illustrations of tables. While these examples are similar to the design your class has selected, they are probably not exactly the same. When normalizing your database, use the designs your class has selected, including the designated data types, data sizes and other specifications.

The Challenge: Analyze and then normalize the design of tblPerson by moving some of the fields (and their data) to new, normalized tables.

Note: The column names, data types, and null properties in the diagram below may be different from the design chosen by your class. Preparation Backup It is generally safer – and wiser – not to change the original data. Before making any changes to the data you have imported … Make a copy* of tblPersonSTAGING. Name it tblPersonBACKUP. Verify that tblPersonSTAGING is 100% identical to the original table in both data definition and the data itself. You now have two tables: tblPersonBACKUP and tblPersonSTAGING * See BackupTables.ppt for instructions on making a copy of a table. Staging

SOLUTION to the CHALLENGE The Final Design of Each Table SOLUTION to the CHALLENGE Start with functional dependency analysis. Redesign the data model and the physical data model based on those functional dependencies. Create the new (empty) tables (seen at right), including tblPerson (new).

Migration Steps INSERT INTO tblMembershipType (MembershipType) SELECT DISTINCT (MembershipType) FROM [dbo].[tblPersonSTAGING]; Generally, three steps are needed to migrate some fields (but not all fields) to a new table: INSERT data from the STAGING table into the parent table. Add a FK to the STAGING table. UPDATE the FK field in the STAGING table. Repeat steps 1-3 for tblMembership Add the FK However, do not create a relationship to tblPersonSTAGING. tblPersonSTAGING is just a transition table, not a production table. Non-normalized, original table MembershipTypeID MembershipID UPDATE tblPersonSTAGING SET MembershipTypeID = mt.MembershipTypeID FROM tblMembershipType mt INNER JOIN tblPersonSTAGING pSTGNG ON mt.MembershipType = pSTGNG.MembershipType

Summary/Recap of the Previous Slide Example: tblPersonSTAGING  tblMembershipType See the illustration on the previous slide Create an empty tblMembershipType with all the fields needed. Include a MembershipTypeID identity field as the primary key. INSERT INTO … tblMembershipType the appropriate data. Verify that the INSERT was successful. Add a MembershipTypeID foreign key field to tblPersonSTAGING. UPDATE the MembershipTypeID foreign key (in tblPersonSTAGING). Verify that the UPDATE was successful.

Migration: COMPLETE! Just in case you discover later that something went horribly wrong … Keep tblPersonBACKUP Keep tblPersonSTAGING Keep your INSERT and UPDATE commands in a script With these files, you may be able to rapidly fix the problem.