CS 4320/5320 Homework 2 - Written Part Solutions
Spring 2015
Due March 4, 2013
2
2.1
Written Part (30 points)
The Cost of Joins (9 points)
(a) Index Nested Loop Join (Clustered B+ Tree Index on S.A) (2 points)
Cost of Scanning R + Cost of index access for

CS 4320/5320 Homework 2
Spring 2015
Due March 4, 2013
This assignment is due on Wednesday, 2015-03-04 at 23:59. It is out of 80 points and counts for 10% of
your overall grade. As before, you must work with one partner for this homework; you may work with

CS4320 Fall 2014
Prelim Solutions
Page 1 of 10
CS4320 Prelim Solutions
Part A) Queries (17 points)
The following questions ask you to write some SQL and Relational Algebra queries. For the
SQL part, you answer for each question must consist of a single SQ

CS4320FinalExamFall2011
CS4320 Fall 2011 Final Exam
December 14, 2011; 9:00-11:30am
The maximum number of points possible is 100. This exam counts for 29% of your overall grade.
Questions vary in difficulty. Do not get stuck on one question. Whenever you

CS4320 Fall 2012
Midterm
Page 1 of 11
This page will be used for grading your exam. Do not write anything on this page.
SECTION
Part A
Potpourri
QUESTION
A.1 (Max: 5 points)
SCORE
SECTION TOTAL
(Max: 22 points)
A.2 (Max: 5 points)
A.3 (Max: 4 points)
A.4

CS4320FinalExamFall2011
CS4320 Fall 2011 Final Exam
December 14, 2011; 9:00-11:30am
The maximum number of points possible is 100. This exam counts for 29% of your overall grade.
Questions vary in difficulty. Do not get stuck on one question. Whenever you

CS4320 Fall 2012
Midterm
Page 1 of 11
This page will be used for grading your exam. Do not write anything on this page.
SECTION
Part A
Potpourri
QUESTION
A.1 (Max: 5 points)
SCORE
SECTION TOTAL
(Max: 22 points)
A.2 (Max: 5 points)
A.3 (Max: 4 points)
A.4

Query 1 (4 Points)
match (queen)-[:FRIEND_OF]-(w)-[:ENEMY_OF]-(queen)
where queen.name="Queen"
return w.name as name
order by w.name ASC
Query 2 (5 Points)
match (e)-[:KILLED]->(f)
where (f)-[:FRIEND_OF]->(cfw_name:'Queen') and (e)-[:ENEMY_OF]->(cfw_name:

CS 4320 Spring 2015 Homework 4
Due: Friday April 17th, 11:59 pm
For this homework, you must work with one partner, as usual. It is out of 78 points and
counts for 10% of your final grade. It will introduce y

CS 4320/5320 Homework 3
Spring 2015
Due 3/18/2015
1
Functional Dependencies
1. Pick an arbitrary f F + ; we need to show f G+ . By denition, F f , i.e. f is implied by a
subset of functional dependencies in F. All these same functional dependencies are co

CS 4320/5320 Homework 3
Spring 2015
Due 3/18/2015, 11:59pm
This assignment is due March 18, 2015. It is out of 70 points and counts for 10% of your overall grade. As
before, you need to work with one partner on this homework.
1
Functional Dependencies (25

CS 4320/5320 Homework 1 Solutions
Spring 2015
Due February 9, 2015
1
SQL and Relational Algebra queries
SQL queries:
(a) SELECT S.storeid
FROM Item I, Sells S
WHERE S.iid = I.iid
GROUP BY S.storeid
HAVING COUNT(DISTINCT(I.color) = 3;
(b) SELECT DISTINCT S

CS 4320/5320 Homework 1
Spring 2015
Due February 9, 2015
This assignment is due on Monday, 2/9/2015 at 11:59pm. It is out of 75 points and counts for 10% of your
overall grade. You must work on this assignment with a partner and both of you will receive
t

CS4320 Fall 2013
Midterm
Page 1 of 14
CS4320 Midterm Exam Solutions
October 29, 2013 (90 minutes working time)
Name: _
Cornell NETID: _
I herewith state that I understand and will adhere to the Cornell Code of Academic
Integrity.
-Signature
Maximum number

CS4320MidtermFall2011
CS4320 Fall 2011 Midterm
October 20, 2011 (7:30-9:30pm)
Name: _
Cornell NETID: _
I herewith state that I understand and will adhere to the Cornell Code of Academic
Integrity. In particular, I will not share the contents of this exam

CS4320MidtermFall2011
CS4320 Fall 2011 Midterm
October 20, 2011 (7:30-9:30pm)
Name: _
Cornell NETID: _
I herewith state that I understand and will adhere to the Cornell Code of Academic
Integrity. In particular, I will not share the contents of this exam

CS4320 Fall 2013
Midterm
Page 1 of 15
CS4320 Midterm Exam
October 29, 2013 (90 minutes working time)
Name: _
Cornell NETID: _
I herewith state that I understand and will adhere to the Cornell Code of Academic
Integrity.
-Signature
Maximum number of points

CS4320 Fall 2013
Final
Page 1 of 20
CS4320 Final Exam Solutions
December 12, 2013
Name: _
Cornell NETID: _
I herewith state that I understand and will adhere to the Cornell Code of Academic
Integrity.
-Signature
Maximum number of points possible: 100. Thi

CS4320 Fall 2014
Final Solutions
Page 1 of 13
CS4320 Final Exam Solutions
Part A) Queries in Various Languages (16 points)
A.1) SQL (4 points). Consider the following schema for a database that keeps track of airplanes
and airlines, which may be familiar

CS4320 Fall 2013
Final
Page 1 of 20
CS4320 Final Exam
December 12, 2013
Name: _
Cornell NETID: _
I herewith state that I understand and will adhere to the Cornell Code of Academic
Integrity.
-Signature
Maximum number of points possible: 100. This exam cou

CS4320 Fall 2014
Final
Page 1 of 15
CS4320 Final Exam
December 10th, 2014 (2 hours working time)
Name: _
Cornell NETID: _
I herewith state that I understand and will adhere to the Cornell Code of Academic
Integrity.
-Signature
Maximum number of points pos

CS4320 Fall 2014
Prelim
Page 1 of 12
CS4320 Prelim Exam
October 28, 2014 (90 minutes working time)
Name: _
Cornell NETID: _
I herewith state that I understand and will adhere to the Cornell Code of Academic
Integrity.
-Signature
Maximum number of points p

Relational Algebra
1
Reminders
v Prelim
will be on Tue March 24th (sorry)
v A good time to start on HW1
After today's lecture, have covered enough to start
on Q1
But expect to have to consult textbook and
documentation
Mon/Wed lectures relevant to rema

Map Reduce and Beyond
1
Where we are
Have seen intro to MR and a few examples
Today: odds and ends
optimizations/writing efficient MR code
related abstractions and alternatives to MR
(Friday: prelim review)
2
Combiners
Many MR frameworks allow you to s

Introduction to Database Systems
CS4320/CS5320
Instructor: Lucja ("Wootsia") Kot
http:/www.cs.cornell.edu/lucja
[email protected]
CS4320/CS5320, Spring 2015
1
Your course staff
Instructor: Lucja Kot
Some awesome PhD, MEng and undergrad
TAs: listed on

Introduction to SQL
(see also: http:/xkcd.com/1409/ J)
Database Management Systems, R. Ramakrishnan and J. Gehrke
1
Admin info
Please make sure you're on CMS and Piazza
piazza.com
cms.csuglab.cornell.edu
Piazza vs. email for questions
Office hours star

Relational Algebra Wrap-Up
1
Reminders
v Be
sure you're in CMS and on Piazza
v HW1 due next week
Will finish RA today (Q1 and Q3), Q2 material
Wed
2
Where we are
v Last
time: Relational algebra formal
definitions and examples
v Today:
Finish division fr

Data storage: Hardware
1
Summary so far
Relational model
SQL
Relational Algebra
Additional features such as triggers, stored
procedures, views.
Basically: the abstraction your RDBMS
provides you
2
Part 2 of the course (next 3 weeks)
How is this abstrac

SQL continued
Database Management Systems, R. Ramakrishnan and J. Gehrke
1
Reminders
Make sure you're on Piazza and in CMS
Office hours start this week
Google Calendar schedule
Linked on Piazza and on course website
Database Management Systems, R. Rama

SQL wrap-up; NULLs
Relational Algebra intro
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke
1
Admin stuff and reminders
v Please
make sure you are both in Piazza and
in CMS
v Prelim date: Mon March 23rd, 7:30 pm
Makeups will be offered if