CMPE Database Systems Exercise #3 Solutions

Slides:



Advertisements
Similar presentations
Normalization Dr. Mario Guimaraes. Data Normalization Primarily a tool to validate and improve a logical design so that it satisfies certain constraints.
Advertisements

CS 174: Web Programming April 28 Class Meeting
Normalization of Database Tables Special adaptation for INFS-3200
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
CS 157B: Database Management Systems II March 18 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron Mak.
Normalization. Introduction Badly structured tables, that contains redundant data, may suffer from Update anomalies : Insertions Deletions Modification.
Week 6 Lecture Normalization
CS 152: Programming Language Paradigms April 9 Class Meeting Department of Computer Science San Jose State University Spring 2014 Instructor: Ron Mak
CS 160: Software Engineering October 8 Class Meeting
1 Chapter 1 Overview of Database Concepts. 2 Chapter Objectives Identify the purpose of a database management system (DBMS) Distinguish a field from a.
CMPE 226 Database Systems September 16 Class Meeting Department of Computer Engineering San Jose State University Fall 2015 Instructor: Ron Mak
Avoiding Database Anomalies
NormalizationNormalization Chapter 4. Purpose of Normalization Normalization  A technique for producing a set of relations with desirable properties,
Concepts of Database Management, Fifth Edition
Logical Database Design Relational Model. Logical Database Design Logical database design: process of transforming conceptual data model into a logical.
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.
CS 157B: Database Management Systems II March 20 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron Mak.
Normalization Well structured relations and anomalies Normalization First normal form (1NF) Functional dependence Partial functional dependency Second.
11/07/2003Akbar Mokhtarani (LBNL)1 Normalization of Relational Tables Akbar Mokhtarani LBNL (HENPC group) November 7, 2003.
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.
CMPE 226 Database Systems November 18 Class Meeting Department of Computer Engineering San Jose State University Fall 2015 Instructor: Ron Mak
Ahsan Abdullah 1 Data Warehousing Lecture-6Normalization Virtual University of Pakistan Ahsan Abdullah Assoc. Prof. & Head Center for Agro-Informatics.
CS 151: Object-Oriented Design October 29 Class Meeting Department of Computer Science San Jose State University Fall 2013 Instructor: Ron Mak
Logical Database Design and the Relational Model.
CS 235: User Interface Design April 28 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
Lecture 4: Logical Database Design and the Relational Model 1.
NormalisationNormalisation Normalization is the technique of organizing data elements into records. Normalization is the technique of organizing data elements.
SLIDE 1IS 257 – Fall 2006 Normalization Normalization theory is based on the observation that relations with certain properties are more effective.
CS 154 Formal Languages and Computability April 19 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
CS 160 and CMPE/SE 131 Software Engineering May 12 Class Meeting Department of Computer Science Department of Computer Engineering San José State University.
CSIS 115 Database Design and Applications for Business
Normalization.
Understanding Data Storage
CMPE Database Systems Workshop June 12 Class Meeting
INLS 623 – Database Normalization
Chapter 4 Logical Database Design and the Relational Model
Normalization Karolina muszyńska
A brief summary of database normalization
Chapter 5: Logical Database Design and the Relational Model
MIS 322 – Enterprise Business Process Analysis
Chapter 4 Relational Databases
Payroll Management System
CMPE Database Systems Exercise #1 Solutions
Example Question–Is this relation Well Structured? Student
Database Normalization
CMPE 226 Database Systems February 21 Class Meeting
Entity-Relationship Model and Diagrams (continued)
CS 174: Server-Side Web Programming February 12 Class Meeting
© 2011 Pearson Education, Inc. Publishing as Prentice Hall
A SIMPLE GUIDE TO FIVE NORMAL FORMS (See the next slide for required reading) Prof. Ghandeharizadeh 2018/11/14.
CMPE 226 Database Systems April 4 Class Meeting
Normalization Referential Integrity
Relational Database.
Database Normalization
CMPE 152: Compiler Design September 11/13 Lab
Normalization A337.
What is a Database? A collection of data organized in a manner that allows access, retrieval, and use of that data.
Normalization.
CMPE 135: Object-Oriented Analysis and Design December 6 Class Meeting
Normalization Normalization theory is based on the observation that relations with certain properties are more effective in inserting, updating and deleting.
CHAPTER 4: LOGICAL DATABASE DESIGN AND THE RELATIONAL MODEL
CMPE 135: Object-Oriented Analysis and Design November 29 Class Meeting Department of Computer Engineering San Jose State University Fall 2018 Instructor:
CMPE/SE 131 Software Engineering March 9 Class Meeting
CMPE 152: Compiler Design February 21/26 Lab
CMPE 152: Compiler Design February 28 / March 5 Lab
Chapter 4 The Relational Model and Normalization
CS 144 Advanced C++ Programming April 25 Class Meeting
CMPE 152: Compiler Design March 7/12 Lab
CMPE 152: Compiler Design May 2 Class Meeting
Presentation transcript:

CMPE 180-38 Database Systems Exercise #3 Solutions Department of Computer Engineering San Jose State University Spring 2017 Instructor: Ron Mak www.cs.sjsu.edu/~mak

Unofficial Field Trip Computer History Museum in Mt. View http://www.computerhistory.org/ Provide your own transportation to the museum. Saturday, May 20, 11:30 – closing time Special free admission (for my students only). Experience a fully restored IBM 1401 mainframe computer from the early 1960s in operation. Do a self-guided tour of the Revolution exhibit. New Make/Software: Change the World exhibit.

1.a. and 1.b. Describe an insertion anomaly with the table. MovieCode MovieName ActorId ActorName AssistantId AssistantName ActorPay M100 Le Film Noir A11 Jean Wayne AA01 Julia $2,200,000 A22 G. Autré $1,500,000 A33 C. Westwood AA02 Rob $2,000,000 A44 Barbara Stan $2,500,000 M200 Horse Opera AA03 Leslie $1,900,000 $2,100,000 A55 R.W. Raygun $1,200,000 Describe an insertion anomaly with the table. You cannot add an actor or an assistant into the table without adding a movie. Describe a deletion anomaly with the table. If Jean Wayne decides not to star in Horse Opera and therefore the fifth row of the table is deleted, we lose the id and name of assistant Leslie.

1.c. Describe a modification anomaly with the table. MovieCode MovieName ActorId ActorName AssistantId AssistantName ActorPay M100 Le Film Noir A11 Jean Wayne AA01 Julia $2,200,000 A22 G. Autré $1,500,000 A33 C. Westwood AA02 Rob $2,000,000 A44 Barbara Stan $2,500,000 M200 Horse Opera AA03 Leslie $1,900,000 $2,100,000 A55 R.W. Raygun $1,200,000 Describe a modification anomaly with the table. If assistant Julia retires and is replaced by another person, three rows of the table need to be modified. Also, three rows need to be modified if assistant Rob retires.

1.d. MovieCode MovieName ActorId ActorName AssistantId AssistantName ActorPay M100 Le Film Noir A11 Jean Wayne AA01 Julia $2,200,000 A22 G. Autré $1,500,000 A33 C. Westwood AA02 Rob $2,000,000 A44 Barbara Stan $2,500,000 M200 Horse Opera AA03 Leslie $1,900,000 $2,100,000 A55 R.W. Raygun $1,200,000 Draw a diagram showing full key, partial, and transitive functional dependencies of the table. Clearly label the type of functional dependency.

1.e. What is the result of normalizing the table to 3NF?

2.a. Year Department Leader ID Amount 2015 CMPE Sigurd Meldal 007777777 $12,000 CS Sami Khuri 002222222 $11,000 2016 Math Bem Cayco 005555555 $10,000 Xiao Su 008888888 You want to record the fact that in the year 2017, Mary Jane, who has ID 003333333 and does not belong to a department, is the leader of the Spartan Committee. Briefly explain why you can or cannot add a 2017 row for her and enter nulls for the Department and Amount fields. You cannot add a 2017 row where the Department field is null. The Department field is part of the composite primary key. Therefore, leaving that field null violates the entity integrity constraint.

2.b. Normalize this table to third normal form (3NF). Year Department Leader ID Amount 2015 CMPE Sigurd Meldal 007777777 $12,000 CS Sami Khuri 002222222 $11,000 2016 Math Bem Cayco 005555555 $10,000 Xiao Su 008888888 Normalize this table to third normal form (3NF). ID  Leader is a transitive functional dependency. We can move those columns into a new table: Year Department ID Amount ID Leader

2.c. Year Department Leader ID Amount 2015 CMPE Sigurd Meldal 007777777 $12,000 CS Sami Khuri 002222222 $11,000 2016 Math Bem Cayco 005555555 $10,000 Xiao Su 008888888 Give a good reason why you may want to leave this table unnormalized. The original table has faster query response.

3.a. Show the full key functional dependencies, any partial functional dependencies, and any transitive functional dependencies.

3.b. Normalize the table to third normal form (3NF).