Homework 3: Relational Database Design Theory (100 points)

Similar documents
Midterm Exam #1 Version A CS 122A Winter 2017

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

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

Midterm Exam #1 Version B CS 122A Winter 2017

Last Name: Doe First Name: John Student ID:

Computer Science 597A Fall 2008 First Take-home Exam Out: 4:20PM Monday November 10, 2008 Due: 3:00PM SHARP Wednesday, November 12, 2008

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

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

Midterm Exam #1 (Version B) CS 122A Spring 2018

Midterm Exam (Version B) CS 122A Spring 2017

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

Example Examination. Allocated Time: 100 minutes Maximum Points: 250

Fundamentals of Database Systems

Functional Dependencies CS 1270

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

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

Homework 8: NoSQL (Hands- On) (100 points, +20 extra points)

CS x265 Exam 3 Spring ALL questions 5 points, except question 11 I will not use a source other than my brain on this exam: (please sign)

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

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

Lecture 11 - Chapter 8 Relational Database Design Part 1

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

CS145 Midterm Examination

Database Management Systems Paper Solution

IMPORTANT: Circle the last two letters of your class account:

Draw A Relational Schema And Diagram The Functional Dependencies In The Relation >>>CLICK HERE<<<

CSIT5300: Advanced Database Systems

Examination paper for TDT4145 Data Modelling and Database Systems

Homework 2: Translating between the ER and relational models Due at 5pm on Wednesday, April 25

Birkbeck. (University of London) BSc/FD EXAMINATION. Department of Computer Science and Information Systems. Database Management (COIY028H6)

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

Theory of Normal Forms Decomposition of Relations. Overview

CSE344 Final Exam Winter 2017

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

Lecture 6a Design Theory and Normalization 2/2

Schema And Draw The Dependency Diagram

Jordan University of Science & Technology Computer Science Department CS 728: Advanced Database Systems Midterm Exam First 2009/2010

CSCI Design of Database Systems Spring 2018 Final Examination. Last Name: First Name: Student Id:

The University of British Columbia

DATABASE MANAGEMENT SYSTEMS

Handout 3: Functional Dependencies and Normalization

Lectures 12: Design Theory I. 1. Normal forms & functional dependencies 2/19/2018. Today s Lecture. What you will learn about in this section

CSE 562 Database Systems

Schema Refinement & Normalization Theory 2. Week 15

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

Solutions to Final Examination

CS348: INTRODUCTION TO DATABASE MANAGEMENT (Winter, 2011) FINAL EXAMINATION

CSCI 5333 DBMS Spring 2018 Final Examination. Last Name: First Name: Student Id:

Self assessment due: Monday 10/29/2018 at 11:59pm (submit via Gradescope)

Chapter 8: Relational Database Design

FUNCTIONAL DEPENDENCIES

CS127 Homework #3. Due: October 11th, :59 P.M. Consider the following set of functional dependencies, F, for the schema R(A, B, C, D, E)

Midterm 2, CS186 Prof. Hellerstein, Spring 2012

CSE 544 Principles of Database Management Systems

UNIT 3 DATABASE DESIGN

customer = (customer_id, _ customer_name, customer_street,

In This Lecture. Normalisation to BCNF. Lossless decomposition. Normalisation so Far. Relational algebra reminder: product

Functional Dependencies and Finding a Minimal Cover

Relational Design 1 / 34

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

Databases The theory of relational database design Lectures for m

Midterm 2: CS186, Spring 2015

CSCI 5333 DBMS Fall 2017 Final Examination. Last Name: First Name: Student Id:

CS 338 Functional Dependencies

COMP7640 Assignment 2

Exercise 9: Normal Forms

CS 474, Spring 2016 Midterm Exam #2

Unit 3 : Relational Database Design

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

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

CS145 Midterm Examination

Operating Systems, Spring 2015 Course Syllabus

Normalization 03. CSE3421 notes

Relational Database Design (II)

HOMEWORK 8. M. Neumann. Due: THU 29 MAR PM. Getting Started SUBMISSION INSTRUCTIONS

The University of British Columbia

L Information Systems for Engineers. Final exam. ETH Zurich, Autumn Semester 2017 Friday

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Techno India Batanagar Computer Science and Engineering. Model Questions. Subject Name: Database Management System Subject Code: CS 601

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

Homework 5: Structured Query Language (SQL) (100 points)

A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS

SCHEMA REFINEMENT AND NORMAL FORMS

CMSC Introduction to Database Systems

Functional dependency theory

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

Exam. Question: Total Points: Score:

COSC Dr. Ramon Lawrence. Emp Relation

The University of Nottingham

The University of British Columbia

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

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

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

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

Exam. Question: Total Points: Score:

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

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

CMU SCS CMU SCS CMU SCS CMU SCS whole nothing but

CSCI DBMS Spring 2017 Final Examination. Last Name: First Name: Student Id:

HOMEWORK 9. M. Neumann. Due: THU 8 NOV PM. Getting Started SUBMISSION INSTRUCTIONS

Transcription:

CS 122A: Introduction to Data Management Spring 2018 Homework 3: Relational Database Design Theory (100 points) Due Date: Wed, Apr 25 (5:00 PM) Submission All HW assignments should be turned in with a filename that contains both your student ID and your name (e.g., 12345678_John_Doe.pdf) and must be submitted online, as a PDF file, through the associated (HW3 in this case) HW3 in Gradescope. See the table below for HW 3 submission opportunities. Note that after the last deadline, Thursday Apr 26th, no further HW 3 submissions will be accepted at all. That is, we will not accept assignments after that time since we will be publishing the solution at that time -- this is important so that students who want to can see the solution before the first Midterm exam. Please turn in all of your work on time! If possible, save your one dropped assignment for the end of the term when you are most likely to want/need it. Date / Time Wednesday, Apr 25 (5:00 PM) Thursday, Apr 26 (5:00PM) Grade Implications Full credit will be available 20 points will be deducted Submission note: please use the provided template to answer each question. Normally, your solution for each question should not EXCEED 1 page for grading purposes. Since there are four questions, four pages will be enough. However, if you think you can t answer one question in a single page, you can insert one additional blank page and use it to answer a question in two pages. In any case, please always start a new question at the beginning of a page. (The template ensures this if you don t exceed one page per question.) 1

1. [25 pts] On further examination of your existing relational schema, your boss is troubled by the fact that two users can have the same phone number as one of their numbers but with different types (e.g., one could say it's a mobile phone and the other could say it's a home phone). She wants to make sure that when two users do have a phone number in common, the type information is consistent. (a) [5 pts] Start by looking at the existing Phone table. What non-trivial functional dependencies does the current table have? (b) [5 pts] What additional functional dependency is needed to express your boss' rule about phone type consistency? (c) [5 pts] Given this new functional dependency, what is the new primary key for the Phone table given its current schema? (d) [5 pts] What normal form is the Phone table currently in after adding the boss s new rule? Briefly show your reasoning. (e) [5 pts] Decompose Phone into multiple tables to produce a well-normalized design (BCNF if possible, 3NF if not) if the current design isn't already there. Your solution must be lossless join and dependency preserving. List the decomposed tables along with their candidate keys. 2

2. [25 pts] After the initial development of Peeeza, your boss wants to add a new feature to keep track of the post viewing activities of students. This will allow the teaching staff to see how much time students generally spend on the system and which posts are more popular among students. An initial schema design as well as its description and some sample data are shown below. (For simplicity, foreign key references were omitted.) Please answer the following questions. -- New table for recording post viewing activities -- Each time a user (user_id) views a post (post_id), a record is inserted into this table -- The attribute view_time is when the viewing happens -- The attribute staying_time is the total time (in seconds) for which the user viewed the post -- A user can potentially view multiple posts at the same time (view_time); however, if a user opens multiple browser tabs on the exact same post at the exact same time, Peeeza will detect that case and record it as one viewing of the post at that time. CREATE TABLE User_Post_Views( user_id VARCHAR(20) NOT NULL, post_id VARCHAR(20) NOT NULL, view_time DATETIME NOT NULL, staying_time INTEGER); INSERT INTO User_Post_Views(user_id,post_id, view_time, staying_time) VALUES ('1', '1', '2018-04-21 05:06:10', 60), ('1', '2', '2018-04-21 05:06:10', 20), ('1', '1', '2018-04-27 09:25:10', 25); (a) [5pts] List all of the functional dependencies involving the attributes of the relation in question. (Just give the basic list, not the closure of that list. ) (b) [5 pts] What are the candidate keys for this relation? (c) [5 pts] Does the relation satisfy 1NF [Yes/No]? Given a short reasoning (<= 2 sentences). (d) [5 pts] Does the relation satisfy 2NF [Yes/No]? Given a short reasoning (<= 2 sentences). (e) [5 pts] Does the relation satisfy 3NF [Yes/No]? Given a short reasoning (<= 2 sentences). 3

3. [25 pts] Given the relation R and the following functional dependencies, answer the following questions. R(A, B, C, D, E) All attributes contain only atomic values. FD1: A BC FD2: CD E FD3: B D FD4: A E (a) [5 pts] Compute A+, the attribute closure of attribute A. (b) [5 pts] List the candidate keys of R. (c) [5 pts] What s the highest normal form that R satisfies and why? (d) [5 pts] If R is not already at least in 3NF, then normalize R into 3NF and show the resulting relation(s) and their candidate keys. Your decomposition should be both join-lossless and dependency-preserving. If R is already in 3NF, just list the candidate keys of R. (e) [5 pts] Is your answer to (d) also in BCNF? Why or why not? 4

4. [25 pts] Given the relation R and the following functional dependencies, answer the following questions. R(A, B, C, D, E, F, G) All attributes contain only atomic values. FD1: AB C FD2: BC E FD3: B D FD4: F G (a) [5 pts] Compute A+, the attribute closure of attribute A. (b) [5 pts] List the candidate keys of R. (c) [5 pts] What s the highest normal form that R satisfies and why? (d) [5 pts] If R is not already at least in 3NF, then normalize R into 3NF and show the resulting relation(s) and their candidate keys. Your decomposition should be both join-lossless and dependency-preserving. If R is already in 3NF, just list the candidate keys of R. (e) [5 pts] Is your answer to (d) also in BCNF? Why or why not? 5