# Homework 1: Relational Algebra and SQL (due February 10 th, 2016, 4:00pm, in class hard-copy please)

Size: px
Start display at page:

Download "Homework 1: Relational Algebra and SQL (due February 10 th, 2016, 4:00pm, in class hard-copy please)"

Transcription

1 Virginia Tech. Computer Science CS 4604 Introduction to DBMS Spring 2016, Prakash Homework 1: Relational Algebra and SQL (due February 10 th, 2016, 4:00pm, in class hard-copy please) Reminders: a. Out of 100 points. Contains 6 pages. b. Rough time-estimates: 3~6 hours. c. Each HW is supposed to be done individually. d. Please type your answers. Illegible handwriting may get no points, at the discretion of the grader. Only drawings may be hand-drawn, as long as they are neat and legible. e. There could be more than one correct answer. We shall accept them all. f. Whenever you are making an assumption, please state it clearly. g. Unless otherwise mentioned, you may use any SQL/RA operator seen in class/in textbook. h. Unless otherwise specified, assume set-semantics for RA and bag-semantics for SQL. i. Feel free to use the linear notation for RA and create intermediate views for SQL. j. Lead TA for this HW: Sorour Amiri. Q1. RA: Warming up [12 points] Consider the following three tables, T1, T2 and T3: T1 A B C D 10 a b a 6 0 T2 E B 1 b 5 c 6 b T3 A N 10 b 25 c 10 b Show the results of the following relational algebra queries (3 points each): Q1.1. Q1.2. Q1.3. Q1.4. σ!!! (T1) σ!!!!!! (T2) σ!!! (T1 T2 T3) T1 T1.C=T2.E T2 Q2. RA: Monotone Operators [15 points] An operator on relations is said to be monotone if whenever we add a tuple to one of its arguments, the result contains all the tuples that it contained before adding the tuple, 1

2 plus perhaps more tuples. Which of the 5 fundamental RA operators we saw in class (see Lecture 2) are monotone? For each either explain why it is monotone, or give a small example showing it is not. Q3. RA: Products and Manufacturers [22 points] Consider the following relational database that stores information about computer hardware products (keys are underlined, field types are omitted): Product (maker, model, type) PC (model, speed, ram, hd, price) Laptop (model, speed, ram, hd, screen, price) Printer (model, color, type, price) The Product relation gives the manufacturer, model number and type (PC/laptop/printer) of various products. The PC relation gives for each model number that is a PC the speed (of the processor, in gigahertz), the amount of RAM (in GB), the size of hard disk (in GB), and the price. The Laptop relation is similar, with screen size included. The Printer relation records whether it is a color printer or not (Yes/No), and the type (laser/ink-jet) and the price. Write the following queries in relational algebra: Q3.1. Q3.2. Q3.3. Q3.4. Q3.5. (2 points) Find the model numbers of all color laser printers. (3 points) Find the model number and price of all products (of any type) made by manufacturer HP. (5 points) Find those manufacturers of at least two different computers (PCs or laptops) with speeds of at least Hint: You may need a self Cartesian product and a join. (6 points) Find the manufacturers who sell exactly three different models of PC. Hint: Similar in spirit to Q3.3, but you may have to use the set difference as well. (6 points) Find the manufacturers who sell PCs with at least all the RAM sizes seen in laptops. Q4. SQL: The Restaurant DB [21 points] The following relational database schema stores information about a restaurant. The primary keys are underlined and field types are omitted. Study the schema and its corresponding description to answer the questions. 2

3 Customer (cid, cname, cage, caddress, cphone) Table(tno, capacity, availability) Item(iid, iname, price) Order( oid, cid, iid, tno, quantity) Employee(eid, ename, eaddress, eage, salary) Reservation(rid, eid, cid, date, time) The customer is someone who eats in the restaurant. The Customer relation provides customer id, the name, age, address and phone number information. The Table relation gives the restaurant s occupancy information that includes the table number, the number of people who can sit on the table, and the table s availability information. The restaurant serves several items. Each of the Items has an identification number (e.g., 82285), name (e.g., salad), and unit price (e.g., \$15). Soon after arrival in the restaurant a customer places an order. Order relation contains order id, customer id, ordered items id, each item s quantity. Each order contains one or more items, and the quantity of each item (e.g., order 10 contains one soup and two salads). Here we are assuming that a customer can visit the restaurant at most once in a day and can t place multiple orders at a time. Restaurant employees serve customers. The Employee relation contains employee id, name, address, age, and salary information. The customer can make a reservation in the restaurant beforehand. The Reservation relation records reservation, employee, and customer ids, and reservation date and time. In this assignment, you will only deal with querying part of SQL. You are NOT allowed to tamper with (change the contents of) the database, i.e., CREATE, INSERT, DELETE, ALTER, UPDATE etc. Write SQL queries that answer the questions below (one query per question). The query answers must not contain duplicates, but you should use the SQL keyword distinct only when necessary. For this question, creation of temporary tables is NOT allowed, i.e., for each question you have to write exactly one SQL statement (possible using nested SQL). Q4.1. (3 points) Find the customer names that ordered Steak. Q4.2. (3 points) Find the name of the employee who made the reservation for both customers James Schlitt and Nicole Diamond. Q4.3. (4 points) Find the name of the highest paid employee(s) whose age is more than 30. Q4.4. (5 points) How many customers ordered more than three items? Q4.5. (6 points) Find those table numbers where people ordered more than \$30 worth of food. 3

4 Q5. SQLite: Storing Employee Information [30 points] This question is on a consumer complaint database that stores information about the complaints government has received about financial products and services. Download and install SQLite3 from Feel free to use SQLite3 for testing and practicing SQL queries in general. Warm-up Follow the documentation and load the small sample database at: It has a table complaints which includes Complaint ID (Primary Key), Date received, Product, Issue, Consumer complaint narrative, Company public response, Company, State, ZIP code, Date sent to company, Company response to consumer, Timely response? (Yes-No), Consumer disputed? (Yes-No). As a sanity check that you have the correct database, running the following command at a Unix/Linux/Cygwin prompt: your-machine% sqlite3 cs4604-hw1.db select count(*) from complaints; should return 50 We want to write SQL queries to do the following: Query1: Return distinct Issues about Credit Karma Inc. company. Hint: you have to look at the Company column. Query2: Count the number of Products in the database. Larger CSV file A bigger raw comma separated value (csv) file is given here: It is a subset from consumer complaint dataset (if you are curious, the official dataset is at We want to write queries to do the following: Query3: List companies which have at least one product in common with Equifax company. Query4: Return all states and total number of complaints reported from them. 4

6 your-machine% wc -l complaints.csv should return 2081 complaints.csv 6

### Homework 1: RA, SQL and B+-Trees (due September 24 th, 2014, 2:30pm, in class hard-copy please)

Virginia Tech. Computer Science CS 5614 (Big) Data Management Systems Fall 2014, Prakash Homework 1: RA, SQL and B+-Trees (due September 24 th, 2014, 2:30pm, in class hard-copy please) Reminders: a. Out

### Homework 1: RA, SQL and B+-Trees (due Feb 7, 2017, 9:30am, in class hard-copy please)

Virginia Tech. Computer Science CS 5614 (Big) Data Management Systems Spring 2017, Prakash Homework 1: RA, SQL and B+-Trees (due Feb 7, 2017, 9:30am, in class hard-copy please) Reminders: a. Out of 100

### Homework 2: E/R Models and More SQL (due February 17 th, 2016, 4:00pm, in class hard-copy please)

Virginia Tech. Computer Science CS 4604 Introduction to DBMS Spring 2016, Prakash Homework 2: E/R Models and More SQL (due February 17 th, 2016, 4:00pm, in class hard-copy please) Reminders: a. Out of

### Homework 4: Query Processing, Query Optimization (due March 21 st, 2016, 4:00pm, in class hard-copy please)

Virginia Tech. Computer Science CS 4604 Introduction to DBMS Spring 2016, Prakash Homework 4: Query Processing, Query Optimization (due March 21 st, 2016, 4:00pm, in class hard-copy please) Reminders:

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

Virginia Tech. Computer Science CS 4604 Introduction to DBMS Spring 2016, Prakash Homework 6: FDs, NFs and XML (due April 13 th, 2016, 4:00pm, hard-copy in-class please) Reminders: a. Out of 100 points.

### Homework 5: Miscellanea (due April 26 th, 2013, 9:05am, in class hard-copy please)

Virginia Tech. Computer Science CS 4604 Introduction to DBMS Spring 2013, Prakash Homework 5: Miscellanea (due April 26 th, 2013, 9:05am, in class hard-copy please) Reminders: a. Out of 100 points. b.

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

Virginia Tech. Computer Science CS 4604 Introduction to DBMS Spring 2015, Prakash Homework 6: FDs, NFs and XML (due April 15 th, 2015, 4:00pm, hard-copy in-class please) Reminders: a. Out of 100 points.

### Project Assignment 2 (due April 6 th, 2016, 4:00pm, in class hard-copy please)

Virginia Tech. Computer Science CS 4604 Introduction to DBMS Spring 2016, Prakash Project Assignment 2 (due April 6 th, 2016, 4:00pm, in class hard-copy please) Reminders: a. Out of 100 points. Contains

### Homework 2: Query Processing/Optimization, Transactions/Recovery (due February 16th, 2017, 9:30am, in class hard-copy please)

Virginia Tech. Computer Science CS 5614 (Big) Data Management Systems Spring 2017, Prakash Homework 2: Query Processing/Optimization, Transactions/Recovery (due February 16th, 2017, 9:30am, in class hard-copy

### Project Assignment 2 (due April 6 th, 2015, 4:00pm, in class hard-copy please)

Virginia Tech. Computer Science CS 4604 Introduction to DBMS Spring 2015, Prakash Project Assignment 2 (due April 6 th, 2015, 4:00pm, in class hard-copy please) Reminders: a. Out of 100 points. Contains

### Homework 3: Map-Reduce, Frequent Itemsets, LSH, Streams (due March 16 th, 9:30am in class hard-copy please)

Virginia Tech. Computer Science CS 5614 (Big) Data Management Systems Spring 2017, Prakash Homework 3: Map-Reduce, Frequent Itemsets, LSH, Streams (due March 16 th, 9:30am in class hard-copy please) Reminders:

### Homework 4: Clustering, Recommenders, Dim. Reduction, ML and Graph Mining (due November 19 th, 2014, 2:30pm, in class hard-copy please)

Virginia Tech. Computer Science CS 5614 (Big) Data Management Systems Fall 2014, Prakash Homework 4: Clustering, Recommenders, Dim. Reduction, ML and Graph Mining (due November 19 th, 2014, 2:30pm, in

### Homework 7: Transactions, Logging and Recovery (due April 22nd, 2015, 4:00pm, in class hard-copy please)

Virginia Tech. Computer Science CS 4604 Introduction to DBMS Spring 2015, Prakash Homework 7: Transactions, Logging and Recovery (due April 22nd, 2015, 4:00pm, in class hard-copy please) Reminders: a.

### CPS 216 Spring 2003 Homework #1 Assigned: Wednesday, January 22 Due: Monday, February 10

CPS 216 Spring 2003 Homework #1 Assigned: Wednesday, January 22 Due: Monday, February 10 Note: This is a long homework. Start early! If you have already taken CPS 196.3 or an equivalent undergraduate course

### Database Systems CSE 303. Outline. Lecture 06: SQL. What is Sub-query? Sub-query in WHERE clause Subquery

Database Systems CSE 303 Lecture 06: SQL 2016 Subquery Outline What is a Subquery Subquery in WHERE clause >ALL, >ANY, >=ALL,

### PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science DECEMBER 2011 EXAMINATIONS CSC 343 H1F Instructors: Horton and Papangelis Duration 3 hours PLEASE HAND IN Examination Aids: None Student

### CS 245 Midterm Exam Solution Winter 2015

CS 245 Midterm Exam Solution Winter 2015 This exam is open book and notes. You can use a calculator and your laptop to access course notes and videos (but not to communicate with other people). You have

### CSE 344 Midterm Nov 1st, 2017, 1:30-2:20

1 SQL 1. (36 points) Acompanymaintainsadatabaseabouttheiremployeesandprojectswiththefollowing schema. Employee(eid, name, salary) Project(pid, title, budget) WorksOn(eid, pid, year) WorksOn records which

### 2.2.2.Relational Database concept

Foreign key:- is a field (or collection of fields) in one table that uniquely identifies a row of another table. In simpler words, the foreign key is defined in a second table, but it refers to the primary

### Chapter 2: The Relational Algebra

CSE 303: Database RDBMS Architecture Lecture 11 How does a SQL engine work? Chapter 2: The Relational Algebra SQL Query Declarative query (from user) Relational Algebra (RA) Plan Translate to relational

### Carnegie Mellon University Department of Computer Science /615 - Database Applications C. Faloutsos & A. Pavlo, Spring 2014.

Carnegie Mellon University Department of Computer Science 15-415/615 - Database Applications C. Faloutsos & A. Pavlo, Spring 2014 Homework 1 IMPORTANT Plagiarism: Homework may be discussed with other students,

### CMU - SCS / Database Applications Spring 2013, C. Faloutsos Homework 1: E.R. + Formal Q.L. Deadline: 1:30pm on Tuesday, 2/5/2013

CMU - SCS 15-415/15-615 Database Applications Spring 2013, C. Faloutsos Homework 1: E.R. + Formal Q.L. Deadline: 1:30pm on Tuesday, 2/5/2013 Reminders - IMPORTANT: Like all homeworks, it has to be done

### Chapter 2: The Relational Algebra

CSE 303: Database Lecture 11 Chapter 2: The Relational Algebra RDBMS Architecture How does a SQL engine work? SQL Query Relational Algebra (RA) Plan Optimized RA Plan Execution Declarative query (from

### Assignment #2. CS Spring 2015 Due on Friday, June 19, 2015, 9 AM For instructions on how to submit your assignment check the course website.

Assignment #2 CS 348 - Spring 2015 Due on Friday, June 19, 2015, 9 AM For instructions on how to submit your assignment check the course website. 1 CS 348 - Spring 2015 : Assignment #2 QUESTION 1. Question

### CS 461: Database Systems. Final Review. Julia Stoyanovich

CS 461: Database Systems Final Review (stoyanovich@drexel.edu) Final exam logistics When: June 6, in class The same format as the midterm: open book, open notes 2 hours in length The exam is cumulative,

### CSC 261/461 Database Systems Lecture 19

CSC 261/461 Database Systems Lecture 19 Fall 2017 Announcements CIRC: CIRC is down!!! MongoDB and Spark (mini) projects are at stake. L Project 1 Milestone 4 is out Due date: Last date of class We will

### CSE 190D Spring 2017 Final Exam

CSE 190D Spring 2017 Final Exam Full Name : Student ID : Major : INSTRUCTIONS 1. You have up to 2 hours and 59 minutes to complete this exam. 2. You can have up to one letter/a4-sized sheet of notes, formulae,

### CS 186 Midterm, Spring 2003 Page 1

UNIVERSITY OF CALIFORNIA College of Engineering Department of EECS, Computer Science Division CS 186 Spring 2003 J. Hellerstein Midterm Midterm Exam: Introduction to Database Systems This exam has five

### Fundamentals of Database Systems

Fundamentals of Database Systems Assignment: 1 Due Date: 8th August, 2017 Instructions This question paper contains 15 questions in 5 pages. Q1: The users are allowed to access different parts of data

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

Carnegie Mellon University Department of Computer Science 15-415/615- Database Applications C. Faloutsos & A. Pavlo, Spring 2015 Prepared by Vinay & Jiayu DUE DATE: Tuesday, 3/24/2015, 1:30pm Homework

### CS 564 Final Exam Fall 2015 Answers

CS 564 Final Exam Fall 015 Answers A: STORAGE AND INDEXING [0pts] I. [10pts] For the following questions, clearly circle True or False. 1. The cost of a file scan is essentially the same for a heap file

### CSE 414 Midterm. April 28, Name: Question Points Score Total 101. Do not open the test until instructed to do so.

CSE 414 Midterm April 28, 2017 Name: Question Points Score 1 35 2 15 3 30 4 21 Total 101 Do not open the test until instructed to do so. The test is closed book and electronics. You are allowed only one

### CS317 File and Database Systems

CS317 File and Database Systems Lecture 3 Relational Model & Languages Part-1 September 7, 2018 Sam Siewert More Embedded Systems Summer - Analog, Digital, Firmware, Software Reasons to Consider Catch

### Modern Database Systems Lecture 1

Modern Database Systems Lecture 1 Aristides Gionis Michael Mathioudakis T.A.: Orestis Kostakis Spring 2016 logistics assignment will be up by Monday (you will receive email) due Feb 12 th if you re not

### Databases. Relational Model, Algebra and operations. How do we model and manipulate complex data structures inside a computer system? Until

Databases Relational Model, Algebra and operations How do we model and manipulate complex data structures inside a computer system? Until 1970.. Many different views or ways of doing this Could use tree

### Database Systems CSE 414

Database Systems CSE 414 Lecture 6: Nested Queries in SQL 1 Announcements WQ2 is due on Sunday 11pm no late days HW2 is due on Tuesday 11pm 2 Lecture Goals Today we will learn how to write (even) more

### 1 (10) 2 (8) 3 (12) 4 (14) 5 (6) Total (50)

Student number: Signature: UNIVERSITY OF VICTORIA Faculty of Engineering Department of Computer Science CSC 370 (Database Systems) Instructor: Daniel M. German Midterm Oct 21, 2004 Duration: 60 minutes

### Fundamentals of Database Systems

Fundamentals of Database Systems Assignment: 2 Due Date: 18th August, 2017 Instructions This question paper contains 10 questions in 6 pages. Q1: Consider the following schema for an office payroll system,

### Administration Naive DBMS CMPT 454 Topics. John Edgar 2

Administration Naive DBMS CMPT 454 Topics John Edgar 2 http://www.cs.sfu.ca/coursecentral/454/johnwill/ John Edgar 4 Assignments 25% Midterm exam in class 20% Final exam 55% John Edgar 5 A database stores

### CMP-3440 Database Systems

CMP-3440 Database Systems Relational DB Languages Relational Algebra, Calculus, SQL Lecture 05 zain 1 Introduction Relational algebra & relational calculus are formal languages associated with the relational

### Relational Model History. COSC 304 Introduction to Database Systems. Relational Model and Algebra. Relational Model Definitions.

COSC 304 Introduction to Database Systems Relational Model and Algebra Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Relational Model History The relational model was

### MASSACHUSETTS INSTITUTE OF TECHNOLOGY Database Systems: Fall 2015 Quiz I

Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.830 Database Systems: Fall 2015 Quiz I There are 12 questions and 13 pages in this quiz booklet. To receive

### Database Management Systems Paper Solution

Database Management Systems Paper Solution Following questions have been asked in GATE CS exam. 1. Given the relations employee (name, salary, deptno) and department (deptno, deptname, address) Which of

### Lecture 2: Introduction to SQL

Lecture 2: Introduction to SQL Lecture 2 Announcements! 1. If you still have Jupyter trouble, let us know! 2. Enroll to Piazza!!! 3. People are looking for groups. Team up! 4. Enrollment should be finalized

### Chapter 2 Introduction to Relational Models

CMSC 461, Database Management Systems Spring 2018 Chapter 2 Introduction to Relational Models These slides are based on Database System Concepts book and slides, 6th edition, and the 2009 CMSC 461 slides

### PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science APRIL 2015 EXAMINATIONS CSC 343 H1S Instructor: Horton and Liu Duration 3 hours PLEASE HAND IN Examination Aids: None Student Number: Family

### COMP9311 Week 10 Lecture. DBMS Architecture. DBMS Architecture and Implementation. Database Application Performance

COMP9311 Week 10 Lecture DBMS Architecture DBMS Architecture and Implementation 2/51 Aims: examine techniques used in implementation of DBMSs: query processing (QP), transaction processing (TxP) use QP

### Announcements. Relational Model & Algebra. Example. Relational data model. Example. Schema versus instance. Lecture notes

Announcements Relational Model & Algebra CPS 216 Advanced Database Systems Lecture notes Notes version (incomplete) available in the morning on the day of lecture Slides version (complete) available after

### CS-245 Database System Principles Winter 2002 Assignment 4

CS-245 Database System Principles Winter 2002 Assignment 4 Due at the beginning of class on Tuesday, February 19 State all assumptions and show all work. Subscribe to cs245@lists.stanford.edu to receive

### Relational Model 2: Relational Algebra

Yufei Tao Department of Computer Science and Engineering Chinese University of Hong Kong The relational model defines: 1 the format by which data should be stored; 2 the operations for querying the data.

### Database Management Systems (COP 5725) Homework 3

Database Management Systems (COP 5725) Homework 3 Instructor: Dr. Daisy Zhe Wang TAs: Yang Chen, Kun Li, Yang Peng yang, kli, ypeng@cise.uf l.edu November 26, 2013 Name: UFID: Email Address: Pledge(Must

### Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

CHAPTER 19 Query Optimization Introduction Query optimization Conducted by a query optimizer in a DBMS Goal: select best available strategy for executing query Based on information available Most RDBMSs

### CMSC 424 Database design Lecture 18 Query optimization. Mihai Pop

CMSC 424 Database design Lecture 18 Query optimization Mihai Pop More midterm solutions Projects do not be late! Admin Introduction Alternative ways of evaluating a given query Equivalent expressions Different

### CSC 261/461 Database Systems Lecture 13. Fall 2017

CSC 261/461 Database Systems Lecture 13 Fall 2017 Announcement Start learning HTML, CSS, JavaScript, PHP + SQL We will cover the basics next week https://www.w3schools.com/php/php_mysql_intro.asp Project

### Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No.

Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No. # 5 Structured Query Language Hello and greetings. In the ongoing

### Ian Kenny. November 28, 2017

Ian Kenny November 28, 2017 Introductory Databases Relational Algebra Introduction In this lecture we will cover Relational Algebra. Relational Algebra is the foundation upon which SQL is built and is

### McGill April 2009 Final Examination Database Systems COMP 421

McGill April 2009 Final Examination Database Systems COMP 421 Wednesday, April 15, 2009 9:00-12:00 Examiner: Prof. Bettina Kemme Associate Examiner: Prof. Muthucumaru Maheswaran Student name: Student Number:

### Endterm Exam (Version B) CS 122A Spring 2017

NAME: SOLUTION SEAT NO.: STUDENT ID: Endterm Exam (Version B) CS 122A Spring 2017 Max. Points: 100 (Please read the instructions carefully) Instructions: - The total time for the exam is 120 minutes; be

### Announcements. From SQL to RA. Query Evaluation Steps. An Equivalent Expression

Announcements Introduction to Data Management CSE 344 Webquiz 3 is due tomorrow Lectures 9: Relational Algebra (part 2) and Query Evaluation 1 2 Query Evaluation Steps Translate query string into internal

### What is an algebra? A formal system of manipulation of symbols to deal with general statements of relations.

Lecture 4. Relational Algebra By now, we know that (a) All data in a relational DB is stored in tables (b) there are several tables in each DB (because of Normalization), and (c) often the information

### CS121 MIDTERM REVIEW. CS121: Relational Databases Fall 2017 Lecture 13

CS121 MIDTERM REVIEW CS121: Relational Databases Fall 2017 Lecture 13 2 Before We Start Midterm Overview 3 6 hours, multiple sittings Open book, open notes, open lecture slides No collaboration Possible

### Introduction to Query Processing and Query Optimization Techniques. Copyright 2011 Ramez Elmasri and Shamkant Navathe

Introduction to Query Processing and Query Optimization Techniques Outline Translating SQL Queries into Relational Algebra Algorithms for External Sorting Algorithms for SELECT and JOIN Operations Algorithms

### CS 245 Midterm Exam Winter 2014

CS 245 Midterm Exam Winter 2014 This exam is open book and notes. You can use a calculator and your laptop to access course notes and videos (but not to communicate with other people). You have 70 minutes

### CS 200 Fall 2012 Assignment 8 SQL Due Monday November 10 by 4:00 pm

CS 200 Fall 2012 Assignment 8 SQL Due Monday November 10 by 4:00 pm Read Notes 6, in particular Database Design and Watcom SQL User s Guide. Please follow these instructions very carefully to find the

### Final Exam CSE232, Spring 97

Final Exam CSE232, Spring 97 Name: Time: 2hrs 40min. Total points are 148. A. Serializability I (8) Consider the following schedule S, consisting of transactions T 1, T 2 and T 3 T 1 T 2 T 3 w(a) r(a)

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

CS542 EXAMPLE EXAM Elke A. Rundensteiner Example Examination Allocated Time: 100 minutes Maximum Points: 250 STUDENT NAME: General Instructions: This test is a closed book exam (besides one cheat sheet).

### CSE 344 Midterm. Monday, November 9th, 2015, 9:30-10:20. Question Points Score Total: 70

CSE 344 Midterm Monday, November 9th, 2015, 9:30-10:20 Name: Question Points Score 1 30 2 30 3 10 Total: 70 This exam is CLOSED book and CLOSED devices. You are allowed ONE letter-size page with notes

### RELATIONAL DATA MODEL: Relational Algebra

RELATIONAL DATA MODEL: Relational Algebra Outline 1. Relational Algebra 2. Relational Algebra Example Queries 1. Relational Algebra A basic set of relational model operations constitute the relational

### Basic operators: selection, projection, cross product, union, difference,

CS145 Lecture Notes #6 Relational Algebra Steps in Building and Using a Database 1. Design schema 2. Create schema in DBMS 3. Load initial data 4. Repeat: execute queries and updates on the database Database

### MASSACHUSETTS INSTITUTE OF TECHNOLOGY Database Systems: Fall 2009 Quiz I Solutions

Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.830 Database Systems: Fall 2009 Quiz I Solutions There are 15 questions and 12 pages in this quiz booklet.

### Relational Model and Relational Algebra

Relational Model and Relational Algebra CMPSCI 445 Database Systems Fall 2008 Some slide content courtesy of Zack Ives, Ramakrishnan & Gehrke, Dan Suciu, Ullman & Widom Next lectures: Querying relational

### EECS 647: Introduction to Database Systems

EECS 647: Introduction to Database Systems Instructor: Luke Huan Spring 2009 Stating Points A database A database management system A miniworld A data model Conceptual model Relational model 2/24/2009

### 3. Relational Data Model 3.5 The Tuple Relational Calculus

3. Relational Data Model 3.5 The Tuple Relational Calculus forall quantification Syntax: t R(P(t)) semantics: for all tuples t in relation R, P(t) has to be fulfilled example query: Determine all students

### CSE 344 JANUARY 5 TH INTRO TO THE RELATIONAL DATABASE

CSE 344 JANUARY 5 TH INTRO TO THE RELATIONAL DATABASE ADMINISTRATIVE MINUTIAE Midterm Exam: February 9 th : 3:30-4:20 Final Exam: March 15 th : 2:30 4:20 ADMINISTRATIVE MINUTIAE Midterm Exam: February

### Carnegie Mellon University in Qatar Spring Problem Set 4. Out: April 01, 2018

Carnegie Mellon University in Qatar 15415 - Spring 2018 Problem Set 4 Out: April 01, 2018 Due: April 11, 2018 1 1 B + External Sorting [20 Points] Suppose that you just nished inserting several records

### Lecture 3: SQL Part II

Lecture 3 Lecture 3: SQL Part II Copyright: These slides are the modified version of the slides used in CS145 Introduction to Databases course at Stanford by Dr. Peter Bailis Lecture 3 Today s Lecture

### Score. 1 (10) 2 (10) 3 (8) 4 (13) 5 (9) Total (50)

Student number: Signature: UNIVERSITY OF VICTORIA Faculty of Engineering Department of Computer Science CSC 370 (Database Systems) Instructor: Daniel M. German Midterm 18 June 2003 Duration: 75 minutes

### CS145 Final Examination

CS145 Final Examination Spring 2003, Prof. Widom ffl Please read all instructions (including these) carefully. ffl There are 11 problems on the exam, with a varying number of points for each problem and

### CS425 Midterm Exam Summer C 2012

Q1) List five responsibilities of a database-management system. Q2) Fill in the terms in the right hand side of the table that match the description from the list below: Instance SQL Integrity constraints

### Introduction to Data Management CSE 344. Lectures 8: Relational Algebra

Introduction to Data Management CSE 344 Lectures 8: Relational Algebra CSE 344 - Winter 2017 1 Announcements Homework 3 is posted Microsoft Azure Cloud services! Use the promotion code you received Due

### CSCI-6421 Final Exam York University Fall Term 2004

6 December 2004 CS-6421 Final Exam p. 1 of 7 CSCI-6421 Final Exam York University Fall Term 2004 Due: 6pm Wednesday 15 December 2004 Last Name: First Name: Instructor: Parke Godfrey Exam Duration: take

### Introduction to Data Management CSE 344. Lectures 8: Relational Algebra

Introduction to Data Management CSE 344 Lectures 8: Relational Algebra CSE 344 - Winter 2016 1 Announcements Homework 3 is posted Microsoft Azure Cloud services! Use the promotion code you received Due

### CS 582 Database Management Systems II

Review of SQL Basics SQL overview Several parts Data-definition language (DDL): insert, delete, modify schemas Data-manipulation language (DML): insert, delete, modify tuples Integrity View definition

### Agenda. Discussion. Database/Relation/Tuple. Schema. Instance. CSE 444: Database Internals. Review Relational Model

Agenda CSE 444: Database Internals Review Relational Model Lecture 2 Review of the Relational Model Review Queries (will skip most slides) Relational Algebra SQL Review translation SQL à RA Needed for

### CSE 344 MAY 7 TH EXAM REVIEW

CSE 344 MAY 7 TH EXAM REVIEW EXAMINATION STATIONS Exam Wednesday 9:30-10:20 One sheet of notes, front and back Practice solutions out after class Good luck! EXAM LENGTH Production v. Verification Practice

### CSE 190D Spring 2017 Final Exam Answers

CSE 190D Spring 2017 Final Exam Answers Q 1. [20pts] For the following questions, clearly circle True or False. 1. The hash join algorithm always has fewer page I/Os compared to the block nested loop join

### CSE344 Midterm Exam Winter 2017

CSE344 Midterm Exam Winter 2017 February 13, 2017 Please read all instructions (including these) carefully. This is a closed book exam. You are allowed a one page cheat sheet that you can write on both

### CPSC 310: Database Systems / CSPC 603: Database Systems and Applications Final Exam Fall 2005

CPSC 310: Database Systems / CSPC 603: Database Systems and Applications Final Exam Fall 2005 Name: Instructions: 1. This is a closed book exam. Do not use any notes or books, other than your three 8.5-by-11

### Chapter 6 The Relational Algebra and Relational Calculus

Chapter 6 The Relational Algebra and Relational Calculus Fundamentals of Database Systems, 6/e The Relational Algebra and Relational Calculus Dr. Salha M. Alzahrani 1 Fundamentals of Databases Topics so

### Algorithms for Query Processing and Optimization. 0. Introduction to Query Processing (1)

Chapter 19 Algorithms for Query Processing and Optimization 0. Introduction to Query Processing (1) Query optimization: The process of choosing a suitable execution strategy for processing a query. Two

### CS 377 Database Systems

CS 377 Database Systems Relational Algebra and Calculus Li Xiong Department of Mathematics and Computer Science Emory University 1 ER Diagram of Company Database 2 3 4 5 Relational Algebra and Relational

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

Fall 2001 University of California, Berkeley College of Engineering Computer Science Division EECS Prof. Michael J. Franklin FINAL EXAM CS 186 Introduction to Database Systems NAME: STUDENT ID: IMPORTANT:

### CS145 Midterm Examination

CS145 Midterm Examination Spring 2004, Prof. Widom Please read all instructions (including these) carefully. There are 9 problems on the exam, with a varying number of points for each problem and subproblem

### Database Design Process

Database Design Process Real World Functional Requirements Requirements Analysis Database Requirements Functional Analysis Access Specifications Application Pgm Design E-R Modeling Choice of a DBMS Data

### Announcements. Subqueries. Lecture Goals. 1. Subqueries in SELECT. Database Systems CSE 414. HW1 is due today 11pm. WQ1 is due tomorrow 11pm

Announcements Database Systems CSE 414 Lecture 6: Nested Queries in SQL HW1 is due today 11pm WQ1 is due tomorrow 11pm no late days WQ3 is posted and due on Oct. 19, 11pm 1 2 Lecture Goals Today we will

### CSE 344 JANUARY 19 TH SUBQUERIES 2 AND RELATIONAL ALGEBRA

CSE 344 JANUARY 19 TH SUBQUERIES 2 AND RELATIONAL ALGEBRA ASSORTED MINUTIAE Winter storm Inga Online quiz out after class Still due Wednesday, will be shorter but through today s lecture For SQLite submissions,

### 6.893 Database Systems: Fall Quiz 2 THIS IS AN OPEN BOOK, OPEN NOTES QUIZ. NO PHONES, NO LAPTOPS, NO PDAS, ETC. Do not write in the boxes below

Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.893 Database Systems: Fall 2004 Quiz 2 There are 14 questions and 12 pages in this quiz booklet. To receive

### 6. Relational Algebra (Part II)

6. Relational Algebra (Part II) 6.1. Introduction In the previous chapter, we introduced relational algebra as a fundamental model of relational database manipulation. In particular, we defined and discussed