Chapter Eight: Database Redesign Database Processing: Fundamentals, Design, and Implementation.

Slides:



Advertisements
Similar presentations
Relational Terminology. Normalization A method where data items are grouped together to better accommodate business changes Provides a method for representing.
Advertisements

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 8-1 David M. Kroenke’s Chapter Eight: Database Redesign Database Processing:
Fundamentals, Design, and Implementation, 9/e Chapter 8 Database Redesign.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 9-1 COS 346 Day 20.
Database Processing: Fundamentals, Design, and Implementation, 9/e by David M. KroenkeChapter 5/1 Copyright © 2004 Please……. No Food Or Drink in the class.
SQL Lecture 10 Inst: Haya Sammaneh. Example Instance of Students Relation  Cardinality = 3, degree = 5, all rows distinct.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 8-1 David M. Kroenke’s Chapter Eight: Database Redesign Database Processing:
Fundamentals, Design, and Implementation, 9/e COS 346 Day 8.
Fundamentals, Design, and Implementation, 9/e COS 346 Day 11.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 4-1 David M. Kroenke Database Processing Chapter 7/8 Structured Query.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 7-1 COS 346 Day 11.
Fundamentals, Design, and Implementation, 9/e Chapter 5 Database Design.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 6-1 David M. Kroenke Database Processing Chapter 6 Transforming Data.
Prentice Hall © COS 346 Day Agenda Questions? Assignment 7 Corrected –4 A’s and 4 B’s Assignment 8 posted –Due April 6 Quiz 2 next class.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 7-1 COS 346 Day 12.
RELATIONSHIP  THE WAY TABLES ARE RELATED  A TABLE MUST PARTICIPATE IN AT LEAST ONE RELATIONSHIP  IN A BINARY RELATIONSHIP TWO ENTITIES PARTICIPATE 
Fundamentals, Design, and Implementation, 9/e Chapter 6 Introduction to Structured Query Language (SQL)
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 8-1 COS 346 Day 17.
David M. Kroenke and David J
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 7-1 David M. Kroenke’s Chapter Seven: SQL for Database Construction and.
Transforming Data Models into Database Designs
Database Constraints. Database constraints are restrictions on the contents of the database or on database operations Database constraints provide a way.
Chapter 3 The Relational Model and Normalization
Web Application Development. Tools to create a simple web- editable database QSEE MySQL (or PHPMyAdmin) PHP TableEditor.
Chapter Six Professor Adams’ Slides. Note that entities are shadowed, tables are not. Note that entities have no physical existence (blueprint) Note.
David M. Kroenke and David J. Auer Database Processing: F undamentals, Design, and Implementation Chapter Six: Transforming Data Models into Database Designs.
Chapter 4 The Relational Model and Normalization.
SQL Basics. 5/27/2016Chapter 32 of 19 Naming SQL commands are NOT case sensitive SQL commands are NOT case sensitive But user identifier names ARE case.
Database Processing: Fundamentals, Design, and Implementation, 9/e by David M. KroenkeChapter 6/1 Copyright © 2004 Please……. No Food Or Drink in the class.
CpSc 3220 The Language of SQL The Language of SQL Chapters
Data Driven Designs 99% of enterprise applications operate on database data or at least interface databases. Most common DBMS are Microsoft SQL Server,
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Commercial RDBMSs Access and Oracle. Access DBMS Architchecture  Can be used as a standalone system on a single PC: -JET Engine -Microsoft Data Engine.
Constraints cis 407 Types of Constraints & Naming Key Constraints Unique Constraints Check Constraints Default Constraints Misc Rules and Defaults Triggers.
Chapter 9 Constraints. Chapter Objectives  Explain the purpose of constraints in a table  Distinguish among PRIMARY KEY, FOREIGN KEY, UNIQUE, CHECK,
Oracle 11g: SQL Chapter 4 Constraints.
SQL for Database Construction and Application Processing
Chapter 4 Constraints Oracle 10g: SQL. Oracle 10g: SQL 2 Objectives Explain the purpose of constraints in a table Distinguish among PRIMARY KEY, FOREIGN.
Database Processing: Fundamentals, Design, and Implementation, 9/e by David M. KroenkeChapter 8/1 Copyright © 2004 Please……. No Food Or Drink in the class.
Fundamentals, Design, and Implementation, 9/e Chapter 8 Database Redesign.
1 DBS201: More on SQL Lecture 3. 2 Agenda How to use SQL to update table definitions How to update data in a table How to join tables together.
Chapter 5 : Integrity And Security  Domain Constraints  Referential Integrity  Security  Triggers  Authorization  Authorization in SQL  Views 
Managing Database With Oracle Replacement for Ch10 COP 4708.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 5 (Part a): Logical Database Design and the Relational Model Modern Database Management.
CREATE TABLE ARTIST ( ArtistID int NOT NULL IDENTITY (1,1), Namechar(25) NOT NULL, TEXT ERROR Nationality char (30) NULL, Birthdate numeric (4,0) NULL,
Constraints Review. What is a constraint? Unique – forbids duplicate values Referencial – Foreign key Check Constraint – sets restrictions on data added.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 6-1 David M. Kroenke’s Chapter Six: Transforming Data Models into Database.
David M. Kroenke and David J. Auer Database Processing Fundamentals, Design, and Implementation Chapter Eight: Database Redesign.
David M. Kroenke and David J. Auer Database Processing Fundamentals, Design, and Implementation Chapter Six: Transforming Data Models into Database Designs.
8-1 Creating Tables. 8-2 Creating Tables: Syntax CREATE TABLE table (column datatype[column_constraint], column datatype[column_constraint], column datatype[column_constraint],...
CompSci 280 S Introduction to Software Development
Structured Query Language
Chapter 5 Database Design
CpSc 3220 The Language of SQL
Chapter 6 - Database Implementation and Use
David M. Kroenke and David J
SQL – More Table Constraints
Module 5: Implementing Data Integrity by Using Constraints
COS 346 Day 8.
Database Processing: David M. Kroenke’s Chapter Six:
CHAPTER 4: LOGICAL DATABASE DESIGN AND THE RELATIONAL MODEL
CS122 Using Relational Databases and SQL
Database Processing: David M. Kroenke’s Chapter Seven:
CS122 Using Relational Databases and SQL
Chapter 8 Database Redesign
Database Processing: David M. Kroenke’s Chapter Six:
CS1222 Using Relational Databases and SQL
CS122 Using Relational Databases and SQL
Database Processing: David M. Kroenke’s Chapter Six:
CS122 Using Relational Databases and SQL
Presentation transcript:

Chapter Eight: Database Redesign Database Processing: Fundamentals, Design, and Implementation

Non-Correlated Subquery 8-2 SELECTA.Name FROMARTIST A WHEREA.Artist IN (SELECT W.ArtistID FROMWORK W WHERE W.Title = ‘Mystic Fabric’);

Correlated Subquery 8-3 SELECT W1.Title, W1.Copy FROMWORK W1 WHERE W1.Title IN (SELECT W2.Title FROM WORK W2 WHERE W1.Title = W2.Title AND W1.WorkID <> W2.WorkID);

Checking Functional Dependencies 8-4 Department  BudgetCode SELECT E1.Department, E1.BudgetCode FROM EMPLOYEE E1 WHERE E1.Department IN (SELECT E2.Department FROM EMPLOYEE E2 WHERE E1.Department = E2.Department AND E1.BudgetCode <> E2.BudgetCode);

Checking Functional Dependencies 8-5 SELECT E1.Department, E1.BudgetCode FROM EMPLOYEE E1 WHERE EXISTS (SELECT * FROM EMPLOYEE E2 WHERE E1.Department = E2.Department AND E1.BudgetCode <> E2.BudgetCode);

Double NOT EXISTS 8-6 The following code determines the name of any ARTIST that is of interest to every CUSTOMER: SELECT A.Name FROM ARTIST AS A WHERE NOT EXISTS (SELECT C.CustomerID FROM CUSTOMER C WHERE NOT EXISTS (SELECT CI.CustomerID FROM CUSTOMER_artist_int CI WHERE C.CustomerID = CI.CustomerID AND A.ArtistID = CI.ArtistID));

Reverse Engineered Data Model: Logical Model 8-7

Reverse Engineered Data Model: Physical Model 8-8

RE Dependency Graph: CUSTOMER with Two Views 8-9

RE Dependency Graph: Tables and Views [Incomplete] 8-10

Composite Dependency Graph [Incomplete] 8-11

Database Redesign Changes 8-12 Changing tables and columns  Changing table names  Adding and dropping table columns  Changing data type or constraints  Adding and dropping constraints Changing relationships  Changing cardinalities  Adding and deleting relationships  Adding and removing relationship for de-normalization

Changing Minimum Cardinalities 8-13 On the parent side:  To change from zero to one, change the foreign key constraint from NULL to NOT NULL  Can only be done if all the rows in the table have a value.  To change from one to zero, change the foreign key constraint from NOT NULL to NULL On the child side:  Add (to change from zero to one) or drop (to change from one to zero) triggers that enforce the constraint

Changing Maximum Cardinalities: 1:N to N:M Example 8-14

Forward Engineering 8-15 Forward engineering is the process of applying data model changes to an existing database Results of forward engineering should be tested before using it on an operational database Some tools will show the SQL that will execute during the forward engineering process  If so, that SQL should be carefully reviewed