Fundamentals of Database Systems

Similar documents
BCNF. Yufei Tao. Department of Computer Science and Engineering Chinese University of Hong Kong BCNF

SCHEMA REFINEMENT AND NORMAL FORMS

CSIT5300: Advanced Database Systems

UNIT 3 DATABASE DESIGN

Normalization. Murali Mani. What and Why Normalization? To remove potential redundancy in design

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Winter 2009 Lecture 4 - Schema Normalization

MIDTERM EXAMINATION Spring 2010 CS403- Database Management Systems (Session - 4) Ref No: Time: 60 min Marks: 38

DBMS Chapter Three IS304. Database Normalization-Comp.

Relational Design: Characteristics of Well-designed DB

Functional Dependencies and Finding a Minimal Cover

Normalization. { Ronak Panchal }

Chapter 8: Relational Database Design

Design Theory for Relational Databases

Database Management Systems Paper Solution

Functional Dependencies CS 1270

The Relational Data Model

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Databases -Normalization I. (GF Royle, N Spadaccini ) Databases - Normalization I 1 / 24

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Fall 2009 Lecture 3 - Schema Normalization

Unit 3 : Relational Database Design

Exercise 9: Normal Forms

Relational Database Design (II)

Homework 6: FDs, NFs and XML (due April 13 th, 2016, 4:00pm, hard-copy in-class please)

customer = (customer_id, _ customer_name, customer_street,

Review: Attribute closure

Lecture 6a Design Theory and Normalization 2/2

Schema Refinement & Normalization Theory 2. Week 15

This lecture. Databases -Normalization I. Repeating Data. Redundancy. This lecture introduces normal forms, decomposition and normalization.

Part II: Using FD Theory to do Database Design

Unit IV. S_id S_Name S_Address Subject_opted

CS403- Database Management Systems Solved MCQS From Midterm Papers. CS403- Database Management Systems MIDTERM EXAMINATION - Spring 2010

CS411 Database Systems. 05: Relational Schema Design Ch , except and

Chapter 16. Relational Database Design Algorithms. Database Design Approaches. Top-Down Design

5 Normalization:Quality of relational designs

COSC Dr. Ramon Lawrence. Emp Relation

CS403- Database Management Systems Solved Objective Midterm Papers For Preparation of Midterm Exam

Relational Database Design Theory. Introduction to Databases CompSci 316 Fall 2017

Homework 3: Relational Database Design Theory (100 points)

Normalization. Anomalies Functional Dependencies Closures Key Computation Projecting Relations BCNF Reconstructing Information Other Normal Forms

Lecture 11 - Chapter 8 Relational Database Design Part 1

Chapter 14 Outline. Normalization for Relational Databases: Outline. Chapter 14: Basics of Functional Dependencies and

Relational Model and Relational Algebra A Short Review Class Notes - CS582-01

More Normalization Algorithms. CS157A Chris Pollett Nov. 28, 2005.

Database Design Principles

COMP7640 Assignment 2

Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 10-2

Lecture 4. Database design IV. INDs and 4NF Design wrapup

Chapter 10. Chapter Outline. Chapter Outline. Functional Dependencies and Normalization for Relational Databases

Redundancy:Dependencies between attributes within a relation cause redundancy.

Relational Design Theory

Functional Dependencies and Single Valued Normalization (Up to BCNF)

Acknowledgement: The slides were kindly lent by Doc. RNDr. Tomas Skopal, Ph.D., Department of Software Engineering, Charles University in Prague

CSE 562 Database Systems

Solutions to Final Examination

Informal Design Guidelines for Relational Databases

MODULE: 3 FUNCTIONAL DEPENDENCIES

CMU SCS CMU SCS CMU SCS CMU SCS whole nothing but

Normalization 03. CSE3421 notes

Chapter 6: Relational Database Design

Normalisation. Normalisation. Normalisation

CS/B.Tech/CSE/New/SEM-6/CS-601/2013 DATABASE MANAGEMENENT SYSTEM. Time Allotted : 3 Hours Full Marks : 70

Database Management System Prof. Partha Pratim Das Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

Functional Dependencies and. Databases. 1 Informal Design Guidelines for Relational Databases. 4 General Normal Form Definitions (For Multiple Keys)

Database Design Theory and Normalization. CS 377: Database Systems

Homework 6. Question Points Score Query Optimization 20 Functional Dependencies 20 Decompositions 30 Normal Forms 30 Total: 100

Chapter 14. Database Design Theory: Introduction to Normalization Using Functional and Multivalued Dependencies

Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications. Overview - detailed. Goal. Faloutsos & Pavlo CMU SCS /615

1. Considering functional dependency, one in which removal from some attributes must affect dependency is called

Functional Dependencies & Normalization for Relational DBs. Truong Tuan Anh CSE-HCMUT

Last Name: Doe First Name: John Student ID:

Relational Database design. Slides By: Shree Jaswal

Schema Normalization. 30 th August Submitted By: Saurabh Singla Rahul Bhatnagar

Database Systems. Basics of the Relational Data Model

Solutions to Final Examination

Desired properties of decompositions

Lectures 5 & 6. Lectures 6: Design Theory Part II

Institute of Southern Punjab, Multan

The University of British Columbia

EECS-3421a: Test #2 Queries

Functional Dependencies and Normalization for Relational Databases Design & Analysis of Database Systems

Databases Tutorial. March,15,2012 Jing Chen Mcmaster University

Chapter 10. Normalization. Chapter Outline. Chapter Outline(contd.)

Relational design algorithms

Database Management

Combining schemas. Problems: redundancy, hard to update, possible NULLs

Database Constraints and Design

Steps in normalisation. Steps in normalisation 7/15/2014

Database design III. Quiz time! Using FDs to detect anomalies. Decomposition. Decomposition. Boyce-Codd Normal Form 11/4/16

Schema Refinement and Normal Forms

Chapter 7: Relational Database Design

Theory of Normal Forms Decomposition of Relations. Overview

Professor: Pete Keleher! Closures, candidate keys, canonical covers etc! Armstrong axioms!

Databases The theory of relational database design Lectures for m

DATABASE MANAGEMENT SYSTEM SHORT QUESTIONS. QUESTION 1: What is database?

Relational Design Theory. Relational Design Theory. Example. Example. A badly designed schema can result in several anomalies.

The University of British Columbia

Relational Design 1 / 34

Database Management Systems (Classroom Practice Booklet Solutions)

LOGICAL DATABASE DESIGN Part #2/2

CS352 Lecture - Conceptual Relational Database Design

Transcription:

Fundamentals of Database Systems Assignment: 3 Due Date: 23st August, 2017 Instructions This question paper contains 15 questions in 6 pages. Q1: Consider the following relation and its functional dependencies, where the primary key is underlined. Normalize the above relation to BCNF. A. r1(a, C); r2(b, D); r3(a,b,c, D, E) B. r1(a, C); r2(b, D); r3(a,b,c, E) C. r1(a, C); r2(b, D); r3(a,b,d, E) D. r1(a, C); r2(b, D); r3(a,b,e) r(a,b, C, D, E) AB CDE A C B D Explanation: A determines C uniquely and B determines E uniquely, while A and B jointly uniquely identify E. Normalizing to 2NF results in all the relations to be normalized to BCNF. Q2: Normalize the following relation in 2NF to 3NF. t(cust id, name, salesperson, region) cust id name cust id salesperson cust id region salesperson region A. t1(cust id, name, salesperson); t2(salesperson, region) B. t1(cust id, name, salesperson); t2(region) C. t1(cust id, name); t2(salesperson, region) D. The relation is not in 2NF. Explanation: No non-prime attribute depends on subset of candidate key, hence the relation is in 2NF. salesperson region creates transitive FD, separately storing the mapping of salesperson to region removes this dependency, hence A is correct. 1

Q3: State if the following statement is True or False. It is possible that a loss-less decomposition does not exhibit dependency preservation. A. True B. False Explanation: A loss-less decomposition may not exhibit dependency preservation. Q4: Normalize the following relation to BCNF. CI(clientNo, interviewdate, interviewtime, staffno, roomno) clientno, interviewdate interviewtime, staffno, roomno stafftno, interviewdate, interviewtime clientno, roomno stafftno, interviewdate roomno A. I(clientNo, interviewdate, interviewtime, roomno) S(stafftNo, interviewdate, roomno) B. I(clientNo, interviewdate, interviewtime, staffno) S(interviewDate, roomno) C. I(clientNo, interviewdate, interviewtime, staffno) S(stafftNo, interviewdate, roomno) D. I(clientNo, interviewdate, interviewtime, staffno) S(stafftNo, roomno) Explanation: The last functional dependency violates BCNF rule as determinant is not a super-key. To remove this dependency, decompose the relation and set up a relation for the non-key determinant with attributes functionally dependent on it. Q5: A relation r(a, B, C) had multivalued dependencies among all its attributes. It was decomposed for achieving a better database as follows: This is an example of what kind of normalization? A. BCNF B. 4NF C. PJNF D. DKNF r1(a, B) r2(b, C) r3(c, A) Explanation: The relation exhibits join dependency, and is normalized to 5NF. Q6: Consider the following statements: (I) We can check if a functional dependency holds by examining a single relation instance. (II) We can check if a functional dependency is violated by examining a single relation instance. Page 2 of 6

A. Only statement I is true. B. Only statement II is true. C. Both I and II are true. D. Neither I nor II is true. Explanation: It cannot be checked if an FD is a part of the scheme by examining a single instance because in future there can be tuple(s) violating the FD whereas if in schema we found a tuple which makes the FD wrong, the FD is violated. Q7: Consider a relation R = (A, B, C, D, E) with multivalued dependencies: { A B, B D } Suppose R contains the tuples (0, 1, 2, 3, 4) and (0, 5, 6, 7, 8). Which of the following tuples must also be in R? A. (0, 1, 6, 7, 4) B. (0, 5, 6, 3, 8) C. (0, 1, 2, 7, 8) D. (0, 1, 6, 3, 4) Explanation: First consider the two given tuples. Try to apply the given MVDs to any pair of tuples that have the same values for the attributes on the left side of the MVD. Each application of an MVD lets you add two tuples to the relation: the tuples formed by swapping the values for the attributes on the right side of the MVD. This can be done using the formal definition of an MVD. Repeat this process until all of the tuples implied by the MVDs are already in the relation. Q8: Let relation R(A, B, C, D, E, F, G, H) satisfy the following functional dependencies: { A B, CH A, B E, BD C, EG H, DE F } Which of the following FDs is also guaranteed to be satisfied in R? A. BFG AE B. CEG AB C. CGH BF D. ADE CH Explanation: To check whether a functional dependency is satisfied by R you need to take its left-hand side, calculate the closure with respect to the original set of the functional dependencies and then check whether the right-hand side is contained within the closure. So in the question only CEG AB is satisfied because closure of CEG = {C, E, G, A, B, H} and AB is in the closure. Q9: Consider a relation R = (A, B, C, D). For which of the following sets of FDs is R in BCNF? A. { AC D, D A, D B, D C } B. { ABC D, ACD B, D C, BCD A } C. { AD C, BC A, BD C, CD B } D. { AC B, A D, C A, D B } Page 3 of 6

Explanation: A relation is in BCNF if for every nontrivial FD, the left-side attributes contain a key. To test whether a set of attributes S contains a key, compute the closure of the attributes in S using all of the FDs. If the closure is all attributes of the relation, then the attributes contain a key; otherwise not. You need to go through this process for each of the given FD set to determine if the relation is in BCNF. So, for each option, find the candidate key and if LHS of every FD contains the candidate key then it is in BCNF. Q10: Consider the following relation instance R: A B C D E a1 b1 c1 d1 e1 a2 b2 c2 d2 e2 a1 b3 c1 d1 e3 a2 b2 c3 d3 e4 a3 b3 c4 d4 e5 a2 b2 c5 d3 e6 Which of the following FDs are satisfied for the above relation instance? (I) A B (II) A C (III) C A (IV) AB C (V) BC A (VI) AC B (VII) E ABCD (VIII) D A A. II, III and VI only B. III, IV, V and VII only C. III, V, VII and VIII only D. I and V only Explanation: An FD is a constraint for the tuples in a relation from a database. An FD X Y require that the value of X uniquely determines the value of Y where X and Y are set of attributes. You need check for each of the given FDs to determine if it is satisfied by the relation instance. Q11: For relation R = (L, M, N, O, P) the following dependencies hold: { M O, NO P, P L and L MN } R is decomposed into R1 = (L, M, N, P) and R2 = (M, O). The decomposition is: A. Lossless decomposition and dependency preserving B. Lossless decomposition and not dependency preserving C. Lossy decomposition and dependency preserving D. Lossy decomposition and not dependency preserving Explanation: To check lossless decomposition, following conditions must hold: 1. Union of Attributes of R1 and R2 must be equal to attribute of R. 2. Intersection of Attributes of R1 and R2 must not be NULL. 3. Common attribute must be a key for at least one relation (R1 or R2) To check dependency preservation, following condition(s) must hold: If we decompose a relation R into relations R1 and R2, all dependencies of R either must be a part of R1 or R2 or must be derivable from combination of FDs of R1 and R2. Q12: Consider a relation R(A, B, C, D). Suppose, the set of functional dependencies F over the relation R is φ except the trivial functional dependencies. Assuming atomicity of attributes, which among the following is the highest normal form satisfied by the relation R? Page 4 of 6

A. 1NF B. 2NF C. 3NF D. BCNF Explanation: As for a relation to be in some normal form some constraints are imposed on FDs but since there is no non-trivial FD hence the above relation is in highest normal form i.e BCNF. Q13: Consider the following relation for published books: BOOK (book title, author, type o f book, price, author a f f iliation, publisher). Suppose the following dependencies exist: { (book title) (publisher, type o f book); (type o f book) (price); (author) (author a f f iliation) }. What is the highest normal form that the above relation satisfies? A. 1NF B. 2NF C. 3NF D. None of these Explanation: There exist partial functional dependencies ( (book title) (publisher, type o f book) and (author) (author a f f iliation)) which violates it from being in 2NF, hence it is in 1NF (atomicity of attributes is always assumed until specifically mentioned). Q14: Consider a relation R with set of functional dependencies F, and another relation S with another set of functional dependencies G. The highest normal forms of one of the relations is BCNF, while for the other, it is 3NF. It is, however, not known which is which. To make a correct identification using a single test, which of the following tests should be used on the relations? (Assume that the closure of F and G are available.) A. Dependency-preservation B. 3NF definition C. Lossless-join D. BCNF definition Explanation: This is because the relation whose highest normal form is 3NF will fail the BCNF test, but both will pass the 3NF test. Q15: Consider a system with the following disk specifications: Rotational Speed = 7200rpm Seek Time = 4ms Data stored per track = 153.6KB Size of file A = 200B Number of sectors per track = 300 What is the average access time to read file A from disk under sequential and random I/O configuration? Page 5 of 6

A. Sequential I/O: 8.194ms; Random I/O: 8.194ms B. Sequential I/O: 8.176ms; Random I/O: 8.194ms C. Sequential I/O: 8.176ms; Random I/O: 8.176ms D. Sequential I/O: 8.194ms; Random I/O: 8.176ms Explanation: Two important observations: 1. File A fits in a single sector therefore random and sequential I/O time will not make difference. 2.The smallest unit that can be read is one sector. Rest of the part is trivial, use the formula mentioned in slide to calculate the average access time. Page 6 of 6