The class slides, your notes, and the sample problem that we worked in class may be helpful for reference.



Similar documents
DATABASE NORMALIZATION

Introduction Decomposition Simple Synthesis Bernstein Synthesis and Beyond. 6. Normalization. Stéphane Bressan. January 28, 2015

CS143 Notes: Normalization Theory

Announcements. SQL is hot! Facebook. Goal. Database Design Process. IT420: Database Management and Organization. Normalization (Chapter 3)

Databases -Normalization III. (N Spadaccini 2010 and W Liu 2012) Databases - Normalization III 1 / 31

Design of Relational Database Schemas

Chapter 10. Functional Dependencies and Normalization for Relational Databases. Copyright 2007 Ramez Elmasri and Shamkant B.

Chapter 10. Functional Dependencies and Normalization for Relational Databases

Functional Dependencies and Finding a Minimal Cover

Normalization in Database Design

Chapter 10 Functional Dependencies and Normalization for Relational Databases

The University of British Columbia

Theory of Relational Database Design and Normalization

CSI 2132 Lab 3. Outline 09/02/2012. More on SQL. Destroying and Altering Relations. Exercise: DROP TABLE ALTER TABLE SELECT

Fundamentals of Database System

SQL DDL. DBS Database Systems Designing Relational Databases. Inclusion Constraints. Key Constraints

Database Design. Marta Jakubowska-Sobczak IT/ADC based on slides prepared by Paula Figueiredo, IT/DB

Functional Dependencies

Normal forms and normalization

Database Design and Normalization

IINF 202 Introduction to Data and Databases (Spring 2012)

C HAPTER 4 INTRODUCTION. Relational Databases FILE VS. DATABASES FILE VS. DATABASES

Quiz 3: Database Systems I Instructor: Hassan Khosravi Spring 2012 CMPT 354

Relational Data Analysis I

Instant SQL Programming

Introduction to Database Systems. Normalization

Creating an Excel Spreadsheet Report

David Dye. Extract, Transform, Load

Database Design and Normalization

Database Design Final Project

Welcome to the topic on the Import from Excel utility.

Schema Design and Normal Forms Sid Name Level Rating Wage Hours

SQL, PL/SQL FALL Semester 2013

Google Docs, Sheets, and Slides: Share and collaborate

Administering a Microsoft SQL Server 2000 Database

sensitivity analysis. Using Excel 2.1 MANUAL WHAT-IF ANALYSIS 2.2 THRESHOLD VALUES

Relational Database Design: FD s & BCNF

6.830 Lecture PS1 Due Next Time (Tuesday!) Lab 1 Out today start early! Relational Model Continued, and Schema Design and Normalization

Security Test s i t ng Eileen Donlon CMSC 737 Spring 2008

MS Designing and Optimizing Database Solutions with Microsoft SQL Server 2008

Theory of Relational Database Design and Normalization

Administering a Microsoft SQL Server 2000 Database

Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification

DbSchema Tutorial with Introduction in SQL Databases

How to use Pcounter for Windows Common Configurations and Options Revised April 30, 2008

IT2305 Database Systems I (Compulsory)

DATABASE DESIGN: Normalization Exercises & Answers

Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases

Introduction to Computing. Lectured by: Dr. Pham Tran Vu

Online Web Learning University of Massachusetts at Amherst

MODULE FRAMEWORK : Dip: Information Technology Network Integration Specialist (ITNIS) (Articulate to Edexcel: Adv. Dip Network Information Specialist)

Schema Refinement and Normalization

Database Design and Normal Forms

Notes on Excel Forecasting Tools. Data Table, Scenario Manager, Goal Seek, & Solver

A Framework for Data Migration between Various Types of Relational Database Management Systems

1 Choosing the right data mining techniques for the job (8 minutes,

BCA. Database Management System

Special Promotions. Magento Extension User Guide. Official extension page: Special Promotions. User Guide: Special Promotions

MODULE 7: FINANCIAL REPORTING AND ANALYSIS

MIS 460 Project Management

ReportBy Notification Examples

CS 377 Database Systems. Database Design Theory and Normalization. Li Xiong Department of Mathematics and Computer Science Emory University

Schema Refinement, Functional Dependencies, Normalization

OBJECT ORIENTED EXTENSIONS TO SQL

Functional Dependency and Normalization for Relational Databases

New Security Options in DB2 for z/os Release 9 and 10

CMPT 354 Database Systems. Simon Fraser University Summer Instructor: Oliver Schulte

Oracle 10g PL/SQL Training

Relational Normalization Theory (supplemental material)

CSCI-GA Database Systems Lecture 7: Schema Refinement and Normalization

Unique promotion code

DBMS. Normalization. Module Title?

CGS2531 Problem Solving Using Computer Software Sample Exam 3. Select the most appropriate answer(s).

CSE 530A Database Management Systems. Introduction. Washington University Fall 2013

Chapter 7: Relational Database Design

Question 1. Relational Data Model [17 marks] Question 2. SQL and Relational Algebra [31 marks]

How To Improve Performance In A Database

Tutorial: Packaging your server build

Databases What the Specification Says

Normalization. Normalization. Normalization. Data Redundancy

How to Create a Form and Manage the Spreadsheet in Google Docs

Administering a Microsoft SQL Server 2000 Database

MySQL for Beginners Ed 3

Unit 3.1. Normalisation 1 - V Normalisation 1. Dr Gordon Russell, Napier University

z Introduction to Relational Databases for Clinical Research Michael A. Kohn, MD, MPP copyright 2007Michael A.

RELATIONAL DATABASE DESIGN

S A M P L E C H A P T E R

2Creating Reports: Basic Techniques. Chapter

ITS410: Database Management

Functional Dependencies and Normalization

How To Save Data On A Spreadsheet

Graham Kemp (telephone , room 6475 EDIT) The examiner will visit the exam room at 15:00 and 17:00.

How to Use the Cash Flow Template

Transcription:

Page 1 of 5 Normalization Lab 12 and Take-home Exam II Objective The goal of this lab is to give you more practice on normalizing a database. You will analyze an existing database to determine the changes needed to convert it to Third Normal Form. You will then use SQL Server to refactor the database without losing any existing data. Resources The class slides, your notes, and the sample problem that we worked in class may be helpful for reference. Turn In Instructions For this lab you will: enter answers in an Angel quiz and make changes to a database on the server. The Angel portion of the lab will count towards your Lab 12 grade. The database portion of the lab will count towards your Exam II grade.

Page 2 of 5 Tasks Problem Setup The marketing manager for a computer products store has been using a spreadsheet to keep track of special sales programs. This worked fine when the store was small. However, the store has been growing and has recently added some kiosks at local malls. The spreadsheet has also grown to include lots of redundancy. The columns of the spreadsheet are as follows: Store: the name of the store or kiosk, like Main or North Grand Mall Address (Addr): the address of the store Manager (Mgr): the manager of the store Manager Phone (MgrPh): the cell phone number of the manager Promotion Name (PName): the name of the promotional plan, like January White Sale Promotion Terms (PTerms): the terms of the promotion, like buy a new computer, get a free soldering iron. Total Sales For Promotion (PTotal): the volume, in dollars, of products sold under a particular promotion at a particular store The terms in parentheses in the list above are abbreviations that you may choose to use in your solution to the problem. We ll treat this table as a single relation: Promotions(Store, Addr, Mgr, MgrPh, PName, PTerms, PTotal) The following assumptions hold: A1: Each store has just one manager, but one person may manage multiple stores. A2: Promotion names are not repeated A3: A promotion only has one set of terms

Page 3 of 5 Algorithmically Normalize the Relation Below are four functional dependencies for the Promotions relation. For each functional dependency answer the two associated questions on the Angel Quiz for Lab 12. FD1: Store Address, Manager Question 1: Why is FD1 a functional dependency for the Promotions Question 2: FD1 violates third normal form (3NF) for the Promotions relation. What is it about FD1 that violates 3NF? FD2: Manager ManagerPh Question 3: Why is FD2 a functional dependency for the Promotions Question 4: FD2 violates 3NF for the Promotions relation. What is it about FD2 that violates 3NF? FD3: Promotion Name Promotion Terms Question 5: Why is FD3 a functional dependency for the Promotions Question 6: FD3 violates 3NF for the Promotions relation. What is it about FD3 that violates 3NF? FD4: Store, Promotion Name Total Sales For Promotion Question 7: Why is FD4 a functional dependency for the Promotions Question 8: FD4 actually satisfies 3NF for the Promotions relation. Why does FD4 satisfy 3NF? Here again are the functional dependencies for the Promotions relation. The functional dependencies that violate third normal form are indicated. Violation! FD1: Store Address, Manager Violation! FD2: Manager Manager Phone Violation! FD3: Promotion Name Promotion Terms FD4: Store, Promotion Name Total Sales For Promotion Question 9: Calculate the closure {Store} + of FD1. Question 10: Decompose the Promotions relation into two new relations based on FD1. Give the relations and attributes in Relation(Attribute1, Attribute2, ) format. Note: Do not skip directly to the final solution. We want to see that you can use the algorithmic technique discussed in class so that you re prepared to deal with very large databases. Question 11: Continue the process of decomposing the relations that still violate third normal form until all the relations are in third normal form. Give the final relations and attributes in Relation(Attribute1, Attribute2, ) format. (Hint: Your final decomposition

Page 4 of 5 should have four relations, two of which have two attributes and two of which have three attributes.) Refactor the Actual Database You should have a new database on the dyknow.cs server named Promos<Username>. This database has one table that matches the original Promotions relation given above. Your final task will be refactoring this database to match your new design. Step 1: Verify that you can access your Promos database. Look at the contents of the Promotions table. Step 2: Create new, empty tables matching your normalized relations from Question 11 above. Be sure to make the column types match those from the corresponding attributes in the existing Promotions table. Set appropriate primary and foreign key constraints on your new tables. Step 3: The biggest step in refactoring your database is to populate the new tables using data from the existing tables. You can do this using SQL commands like: INSERT INTO dbo.manager(manager, ManagerPhone) SELECT DISTINCT Manager, ManagerPhone FROM Promotions At the end of this step you ll copy and paste your SQL commands into the Angel quiz. Note that you ll need to start with a table that has no foreign keys and work backwards up the foreign key constraints. Question 12: Copy and paste into the Angel quiz your four SQL commands for populating your new tables. Step 4: Confirm that all the data from the original Promotions table is now present in your new tables. Delete the original Promotions table from your database. Feedback Please complete the anonymous feedback for Lab 12 on Angel. Turn In Instructions Enter your answers to the quiz on Angel. We will also check your database on the server to see that the appropriate changes were made.

Page 5 of 5 Revision History Feb. 1, 2007 Written by Curt Clifton