Homework 2 (by Prashasthi Prabhakar) Solutions Due: Wednesday Sep 20, 11:59pm

Similar documents
Homework 2 (by Prashasthi Prabhakar) Due: Wednesday Sep 20, 11:59pm

Design theory for relational databases

Relational-Database Design

Normal Forms Lossless Join.

UVA UVA UVA UVA. Database Design. Relational Database Design. Functional Dependency. Loss of Information

Chapter 11, Relational Database Design Algorithms and Further Dependencies

Normal Forms. Dr Paolo Guagliardo. University of Edinburgh. Fall 2016

Relational Database Design

Normal Forms (ii) ICS 321 Fall Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa

CSC 261/461 Database Systems Lecture 13. Spring 2018

Lossless Joins, Third Normal Form

Consider a relation R with attributes ABCDEF GH and functional dependencies S:

Functional Dependencies & Normalization. Dr. Bassam Hammo

Consider a relation R with attributes ABCDEF GH and functional dependencies S:

Schema Refinement and Normal Forms. Why schema refinement?

Relational Database Design

Schema Refinement & Normalization Theory: Functional Dependencies INFS-614 INFS614, GMU 1

The Evils of Redundancy. Schema Refinement and Normal Forms. Functional Dependencies (FDs) Example: Constraints on Entity Set. Example (Contd.

CS54100: Database Systems

Information Systems for Engineers. Exercise 8. ETH Zurich, Fall Semester Hand-out Due

Constraints: Functional Dependencies

Normalization. October 5, Chapter 19. CS445 Pacific University 1 10/05/17

Jordan University of Science and Technology Faculty of Information Technology CS 728: Advanced Database Systems Midterm Exam 1 st Semester 2010/2011

Schema Refinement and Normalization

Schema Refinement: Other Dependencies and Higher Normal Forms

Schema Refinement and Normal Forms

Functional Dependency and Algorithmic Decomposition

CS 186, Fall 2002, Lecture 6 R&G Chapter 15

INF1383 -Bancos de Dados

CSE 132B Database Systems Applications

Functional Dependencies

Schema Refinement and Normal Forms Chapter 19

The Evils of Redundancy. Schema Refinement and Normal Forms. Example: Constraints on Entity Set. Functional Dependencies (FDs) Example (Contd.

The Evils of Redundancy. Schema Refinement and Normal Forms. Example: Constraints on Entity Set. Functional Dependencies (FDs) Refining an ER Diagram

12/3/2010 REVIEW ALGEBRA. Exam Su 3:30PM - 6:30PM 2010/12/12 Room C9000

Schema Refinement and Normal Forms. The Evils of Redundancy. Functional Dependencies (FDs) CIS 330, Spring 2004 Lecture 11 March 2, 2004

Schema Refinement and Normal Forms. The Evils of Redundancy. Schema Refinement. Yanlei Diao UMass Amherst April 10, 2007

Relational Design: Characteristics of Well-designed DB

Normaliza)on and Func)onal Dependencies

Constraints: Functional Dependencies

Review: Keys. What is a Functional Dependency? Why use Functional Dependencies? Functional Dependency Properties

Chapter 3 Design Theory for Relational Databases

Chapter 7: Relational Database Design

Functional Dependencies and Normalization

Design Theory for Relational Databases. Spring 2011 Instructor: Hassan Khosravi

Chapter 7: Relational Database Design. Chapter 7: Relational Database Design

Schema Refinement and Normal Forms. Chapter 19

Design Theory for Relational Databases

Functional Dependency Theory II. Winter Lecture 21

Schema Refinement and Normal Forms. The Evils of Redundancy. Functional Dependencies (FDs) [R&G] Chapter 19

Background: Functional Dependencies. æ We are always talking about a relation R, with a æxed schema èset of attributesè and a

Data Bases Data Mining Foundations of databases: from functional dependencies to normal forms

Problem about anomalies

Relational Database Design Theory Part II. Announcements (October 12) Review. CPS 116 Introduction to Database Systems

Introduction to Data Management CSE 344

The Evils of Redundancy. Schema Refinement and Normalization. Functional Dependencies (FDs) Example: Constraints on Entity Set. Refining an ER Diagram

Functional Dependencies. Applied Databases. Not all designs are equally good! An example of the bad design

CSC 261/461 Database Systems Lecture 11

Design Theory for Relational Databases

But RECAP. Why is losslessness important? An Instance of Relation NEWS. Suppose we decompose NEWS into: R1(S#, Sname) R2(City, Status)

Functional Dependencies

Schema Refinement and Normal Forms

Database Design and Normalization

Design Theory: Functional Dependencies and Normal Forms, Part I Instructor: Shel Finkelstein

Schema Refinement and Normal Forms. Case Study: The Internet Shop. Redundant Storage! Yanlei Diao UMass Amherst November 1 & 6, 2007

Introduction to Data Management. Lecture #7 (Relational DB Design Theory II)

Schema Refinement and Normal Forms

Schema Refinement & Normalization Theory

CSE 344 AUGUST 6 TH LOSS AND VIEWS

DECOMPOSITION & SCHEMA NORMALIZATION

Normal Forms 1. ICS 321 Fall Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa

Introduction. Normalization. Example. Redundancy. What problems are caused by redundancy? What are functional dependencies?

Information Systems (Informationssysteme)

10/12/10. Outline. Schema Refinements = Normal Forms. First Normal Form (1NF) Data Anomalies. Relational Schema Design

CSC 261/461 Database Systems Lecture 12. Spring 2018

Comp 5311 Database Management Systems. 5. Functional Dependencies Exercises

HKBU: Tutorial 4

Databases Lecture 8. Timothy G. Griffin. Computer Laboratory University of Cambridge, UK. Databases, Lent 2009

Chapter 8: Relational Database Design

Year 9 Term 3 Homework

Relational Design Theory II. Detecting Anomalies. Normal Forms. Normalization

Desirable properties of decompositions 1. Decomposition of relational schemes. Desirable properties of decompositions 3

CAS CS 460/660 Introduction to Database Systems. Functional Dependencies and Normal Forms 1.1

Database Design and Implementation

Lectures 6. Lecture 6: Design Theory

Kapitel 3: Formal Design

CS322: Database Systems Normalization

Introduction to Data Management. Lecture #6 (Relational DB Design Theory)

Functional Dependencies and Normalization. Instructor: Mohamed Eltabakh

Databases 2012 Normalization

SCHEMA NORMALIZATION. CS 564- Fall 2015

CSC 261/461 Database Systems Lecture 8. Spring 2017 MW 3:25 pm 4:40 pm January 18 May 3 Dewey 1101

CSC 261/461 Database Systems Lecture 10 (part 2) Spring 2018

Schema Refinement and Normal Forms

5. Data dependences and database schema design. Witold Rekuć Data Processing Technology 104

Lecture 6 Relational Database Design

Schema Refinement. Yanlei Diao UMass Amherst. Slides Courtesy of R. Ramakrishnan and J. Gehrke

Lecture #7 (Relational Design Theory, cont d.)

COSC 430 Advanced Database Topics. Lecture 2: Relational Theory Haibo Zhang Computer Science, University of Otago

CS122A: Introduction to Data Management. Lecture #13: Relational DB Design Theory (II) Instructor: Chen Li

Transcription:

CARNEGIE MELLON UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE 15-445/645 DATABASE SYSTEMS (FALL 2017) PROF. ANDY PAVLO Homework 2 (by Prashasthi Prabhakar) Solutions Due: Wednesday Sep 20, 2017 @ 11:59pm IMPORTANT: Upload a PDF of your answers to Gradescope by 11:59pm on Wednesday Sep 20, 2017. Plagiarism: Homework may be discussed with other students, but all homework is to be completed individually. Typeset all your answers. For your information: Graded out of 100 points; 4 questions total Rough time estimate: 1-4 hours (0.5-1 hours for each question) Revision : 2017/10/22 09:40 Question Points Score Functional Dependencies I 15 Functional Dependencies II 32 Decompositions 20 Normal Forms 33 Total: 100 1

15-445/645 (Fall 2017) Homework 2 Page 2 of 6 Question 1: Functional Dependencies I........................ [15 points] GRADED BY: Mengran Consider the following legal instance of a relational schema S with attributes XY Z: S X Y Z m 20 T m 10 F o 30 T n 30 T o 20 T Table 1: Legal instance of schema S for question 2.1 (a) Which of the following dependencies are violated by the instances of S in Table 1? i. [2 points] Yes No : X Y is violated. ii. [2 points] Yes No : Z X is violated. iii. [2 points] Yes No : Y Z is violated. iv. [2 points] Yes No : XY Z is violated. v. [2 points] Yes No : Y Z X is violated. vi. [2 points] Yes No : XZ Y is violated. (b) [3 points] By only observing the instance of S in Table 1, can you identify the functional dependencies that hold on schema S? Why? Yes No Solution: No, because we can only see an instance. Homework 2 continues...

15-445/645 (Fall 2017) Homework 2 Page 3 of 6 Question 2: Functional Dependencies II....................... [32 points] GRADED BY: Allison For the next set of questions consider the relational schema R = {P, Q, R, S, T, U, V, W } and the set of functional dependencies FD: Q U (1) U V (2) P Q W ST (3) SU T R (4) V T RW (5) R W (6) (a) [8 points] Which of the following is a minimum cover of the FD? Mark all that qualify; if none, mark accordingly, and give your own. answer. i. The given FDs (Eq 1-6), is a minimum cover already. ii. {Q U, U V, P Q S, SU T, SU R, V T R, V T W, R W } iii. {Q U, U V, P Q S, SU T, P Q W, V T R, P Q T, R W } iv. {Q U, U V, P Q S, SU T, V T R, R W } v. {Q U, U V, P Q S, SU T, SU R, V T R, P Q T, R W } vi. none of the above - the cover is Solution: iv (b) Yes/No: Which of the following functional dependencies can be deduced, from the above set of functional dependencies (Eq. (1)-(6))? i. [3 points] Yes No : Q V ii. [3 points] Yes No : QU R iii. [3 points] Yes No : SQ T iv. [3 points] Yes No : SQ W v. [3 points] Yes No : P Q R vi. [3 points] Yes No : V T Q (c) [3 points] True or False: The attribute closure {Q} + is {Q, U, V }. True False (d) [3 points] True or False: The attribute closure {P Q} + is {P, Q, W, S, T }. True False Grading info: It is {P, Q, R, S, T, U, V, W }. Homework 2 continues...

15-445/645 (Fall 2017) Homework 2 Page 4 of 6 Question 3: Decompositions...................................[20 points] GRADED BY: Prashasthi For this set of questions, consider the relation with attributes, X = {A, B, C, D, E, F }, Let the following functional dependencies F D be defined over the relation X : A B B CD E F (a) [2 points] Provide the attribute closure of {AB}. Solution: {AB} + = {ABCD} (b) Consider the decomposition AB, BCD, EF. Mark True or False : i. [3 points] True False : It is lossless ii. [3 points] True False : It is dependency-preserving (c) Consider the decomposition AB, BCDF, EF. Mark True or False : i. [3 points] True False : It is lossless ii. [3 points] True False : It is dependency-preserving (d) Consider the decomposition ABCEF, EBD. Mark True or False : i. [3 points] True False : It is lossless ii. [3 points] True False : It is dependency-preserving Homework 2 continues...

15-445/645 (Fall 2017) Homework 2 Page 5 of 6 Question 4: Normal Forms....................................[33 points] GRADED BY: Leon Consider the relation with attributes, E = {P, Q, R, S}. Suppose that the following functional dependencies hold: (a) [6 points] List all the candidate key(s) for E. Solution: {P Q}, {QR}, {RS}, {P S} Grading info: -2: for each missing candidate key (b) [2 points] Is the relation E in BCNF? Yes No P Q R (7) P Q S (8) R P (9) S Q (10) (c) From the list below, select all applicable choices to justify whether E is (or is not) in BCNF. Note: when we refer to the main requirement for BCNF, we mean: every determinant is a super key. i. [1 point] True False : All FD s satisfy the main requirement. ii. [1 point] True False : FD (7) violates the main requirement. iii. [1 point] True False : FD (8) violates the main requirement. iv. [1 point] True False : FD (9) violates the main requirement. v. [1 point] True False : FD (10) violates the main requirement. (d) [2 points] Is the relation E in 3NF? Yes No (e) From the list below, select all applicable choices to justify whether E is (or is not) in 3NF. Note: when we refer to the secondary requirement for 3NF, we mean: for every FD X A, A is part of a candidate key. i. [1 point] True False : All FD s satisfy the secondary requirement. ii. [1 point] True False : FD (7) violates the secondary requirement. iii. [1 point] True False : FD (8) violates the secondary requirement. iv. [1 point] True False : FD (9) violates the secondary requirement. v. [1 point] True False : FD (10) violates the secondary requirement. (f) [5 points] Give a 3NF decomposition of E that is lossless, dependency preserving, and has as few tables as possible. Solution: E 1,1 =(P, Q, R, S) Grading info: -1: 3NF decomposition with 2 tables; -3: 3NF decomposition more than with 2 tables; -4: 3NF decomposition with more than 5 tables Question 4 continues...

15-445/645 (Fall 2017) Homework 2 Page 6 of 6 (g) [8 points] Give a BCNF decomposition of E that is lossless, and has as few tables as possible. Solution: E 1,1 =(P, R), E 1,2 =(Q, S), E 1,3 =(R, S) Grading info: -5: BCNF decomposition with more than 3 tables End of Homework 2