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

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

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

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

ITEC 3335 Database Development Fall 2018 Final Examination. Last Name: First Name: Student Id:

CSCI 5333 DBMS Fall 2018 Mid-Term Examination. Last Name: First Name: Student Id:

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

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

Homework 3: Relational Database Design Theory (100 points)

Fundamentals of Database Systems

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

COMP7640 Assignment 2

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

Functional dependency theory

Handout 3: Functional Dependencies and Normalization

Introduction to HTML5

CSIT5300: Advanced Database Systems

Solutions to Final Examination

A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS

HTML Overview. With an emphasis on XHTML

Functional Dependencies CS 1270

The Relational Data Model

SCHEMA REFINEMENT AND NORMAL FORMS

Web Development & Design Foundations with XHTML. Chapter 2 Key Concepts

Header. Report Section. Footer

Create a cool image gallery using CSS visibility and positioning property

What is XHTML? XHTML is the language used to create and organize a web page:

MaanavaN.Com DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING QUESTION BANK

Read this before starting!

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

Unit Notes. ICAWEB411A Produce basic client-side script for dynamic web pages Topic 1 Introduction to JavaScript

Design Theory for Relational Databases

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

Examination paper for TDT4145 Data Modelling and Database Systems

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

Implementing a chat button on TECHNICAL PAPER

LOGICAL DATABASE DESIGN Part #2/2

UNIT 3 DATABASE DESIGN

WIRIS quizzes web services Getting started with PHP and Java

Lecture 17. Monday, November 17, 2014

Read this before starting!

Exercise 9: Normal Forms

CSCI 1100L: Topics in Computing Spring 2018 Web Page Project 50 points

IJREAS Volume 2, Issue 2 (February 2012) ISSN: COMPARING MANUAL AND AUTOMATIC NORMALIZATION TECHNIQUES FOR RELATIONAL DATABASE ABSTRACT

CSC309 Midterm Exam Summer 2007

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

Review: Attribute closure

CSCI 6312 Advanced Internet Programming

Lab 4 CSS CISC1600, Spring 2012

CS317 File and Database Systems

Web Programming Spring 2010

Building Desktop RIAs with PHP, HTML & Javascript in AIR. Ed Finkler, ZendCon08, September 17, 2008 funkatron.com /

CS157a Fall 2018 Sec3 Home Page/Syllabus

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

Schema And Draw The Dependency Diagram

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

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

The University of British Columbia

Relational Database Design. Announcements. Database (schema) design. CPS 216 Advanced Database Systems. DB2 accounts have been set up

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

Computer Science E-75 Building Dynamic Websites

CMU SCS CMU SCS CMU SCS CMU SCS whole nothing but

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

5 Normalization:Quality of relational designs

DATABASE MANAGEMENT SYSTEMS

Read this before starting!

Babu Banarasi Das National Institute of Technology and Management

Unit 3 : Relational Database Design

Midterm Exam #1 Version A CS 122A Winter 2017

Normalization 03. CSE3421 notes

Midterm Exam #1 Version B CS 122A Winter 2017

Midterm Exam (Version B) CS 122A Spring 2017

Networks and Web for Health Informatics (HINF 6220)

COSC Dr. Ramon Lawrence. Emp Relation

CIS 408 Internet Computing (3-0-3)

Relational Database Design (II)

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

Solutions to Final Examination

Desired properties of decompositions

Examination examples

[18 marks] Consider the following schema for tracking customers ratings of books for a bookstore website.

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

San José State University Department of Computer Science CS-174, Server-side Web Programming, Section 2, Spring 2018

Web Publishing Basics I

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

Total No. of Questions :09] [Total No. of Pages : 02. II/IV B.Tech. DEGREE EXAMINATIONS, NOV/DEC Second Semester CSE/IT DBMS

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

A designers guide to creating & editing templates in EzPz

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

Name :. Roll No. :... Invigilator s Signature : DATABASE MANAGEMENT SYSTEM

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

Web Programming Fall 2011

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

Exam II Computer Programming 420 Dr. St. John Lehman College City University of New York 20 November 2001

Announcements (January 20) Relational Database Design. Database (schema) design. Entity-relationship (E/R) model. ODL (Object Definition Language)

Read this before starting!

CS 474, Spring 2016 Midterm Exam #2

EECS-3421a: Test #2 Queries

Why HTML5? Why not XHTML2? Learning from history how to drive the future of the Web

Database Management

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

Transcription:

CSCI 5333 DBMS Spring 2018 Final Examination Last Name: First Name: Student Id: Number: Time allowed: two hours. Total score: 100 points. This is a closed book examination but you can bring a cheat sheet. Answer all questions. Turn in the question paper, any answer sheets, the cheat sheet and all rough work. Plan your time well. Academic honesty policy will be followed strictly. Cheating will be pursued vigorously and will result in a failing grade of D or below, a permanent academic record and possibly other more serious penalty. Many questions refer to the Sakila database we have used extensively in lectures and homework. Please refer to the relation schemas in the supplementary sheets to answer these questions.

(1) [24 points] Write a PHP program, t2.php, to accept a HTTP GET parameter fid, the film s id. The program displays the actors appeared in the films, together with the number of films each actor cast in. For example: http://.../t2.php?fid=1 should display the following in the browser. This is because, for example, the film with id 1 has 10 actors, whom appeared in 40 to 19 films. You may assume that there will be no error in the HTTP parameters. Please answer your question in the next page. A skeleton is provided for you below. There is no need to copy the skeleton again in your answer next page. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>csci 5333 DBMS Spring 2018 Final Examination, Question 1</title> </head> <body> <?php // Minimally documented. dbconfit_sakila will make available the // $mysqli object. include('dbconfig_sakila.php'); Your code: write it in the next page. (No need to write the skeleton again in the next page.) $mysqli->close();?> </body> </html>

(1) Answer question (1) here. Write in the back page if necessary.

(2) [28 points] (a) List the ids and names of films with both actors with actor_id 2 and actor_id 95. For example, film_id 47 has actors with ids: 2, 8, 89, 95, 127, 143, 153 and 158. It is the only one with actors with id 2 and 95 respectively. +---------+-----------+ film_id title +---------+-----------+ 47 BABY HALL +---------+-----------+ 1 row in set (0.00 sec) (b) Create a view s18t2 that shows the information about the numbers of times a customer rented a film in the following manner. Note that customer_id 1 rented the flim_id 317 twice. MariaDB [sakila]> select * from s18t2 -> where customer_id = 1 -> and film_id between 300 and 400; +-------------+---------+------------------+ customer_id film_id number of rental +-------------+---------+------------------+ 1 308 1 1 315 1 1 316 1 1 317 2 1 341 1 +-------------+---------+------------------+ 5 rows in set (0.04 sec)

(c) List the film id, title, number of customers rented the film, total number of rentals of the film of all film with id from 1 to 5. You must use the view s18t2. For example, the film AFFAIR PREJUDICE has been rented by 22 different customers. One of these customers rented it twice and thus numrentals is 23. +---------+------------------+--------------+------------+ film_id title numcustomers numrentals +---------+------------------+--------------+------------+ 1 ACADEMY DINOSAUR 23 23 2 ACE GOLDFINGER 7 7 3 ADAPTATION HOLES 12 12 4 AFFAIR PREJUDICE 22 23 5 AFRICAN EGG 12 12 +---------+------------------+--------------+------------+

(d) Define a function MorePopular to check whether one film is more popular than another film with respect to the number of customers rented the films. You must use the view s18t2 in your function. The function has the following prototype: function MorePopular(film_id_1 smallint unsigned, film_id_2 smallint unsigned) returns boolean For example: MariaDB [sakila]> select MorePopular(1,2), MorePopular(1,3), MorePopular(2,3); +------------------+------------------+------------------+ MorePopular(1,2) MorePopular(1,3) MorePopular(2,3) +------------------+------------------+------------------+ 1 1 0 +------------------+------------------+------------------+ This can be explained by: +---------+-------------------------------------+ film_id Number of customers rented the film +---------+-------------------------------------+ 1 23 2 7 3 12 +---------+-------------------------------------+

(3) [6 points] Use Armstrong s axioms and rules to prove that F = {D->CB, B->A, ACD->E} - D->E (4) [14 points] True (T) or False (F) (a) A relation in 2NF but not in 3NF must have more than one candidate keys. (b) There is always one and only one canonical cover for any set of functional dependencies. (c) Assuming that the names of the relations and attributes are correct, there is no syntax error in the following SQL statement: select film_id, count(actor_id) as countactors from film_actor where countactors >=13 group by film_id order by countactors desc; (d) There are three candidate keys in R(A,B,C,D,E) with {A->B, BC->D, D->CA} (e) The XPath expression //author/name returns all <name> elements in an XML document. (f) There is no universally true functional dependency. (g) In MySQL, a trigger can be activated within a transaction.

(5) [8 points] Consider R(A,B,C,D,E) with the set of FDs: {A->BD, BC->E, AB->E, C->B} R is decomposed into R1(A,C), R2(B,C,E) and R3(A,B,D,E). Is the decomposition lossless? Show your reasoning. Write in the back of the page if necessary.

(6) [20 points] Consider R(A,B,C,D,E,F) with F= {B->C, BC->D, C->A, A->CE, AE->F} (a) What are A+, B+, C+, D+, E+ and F+? (b) What are the candidate keys? Show all prime attributes. (c) Give a canonical cover of F. (d) What is the highest normal form (up to BCNF) of R and why? (e) If R is not in BCNF, can you provide a lossless FD preserving decomposition of R into BCNF relations? If yes, show such decomposition. If no, justify your answer.