DATA ACCESS I/Os
Assume: Tables Sells, Likes and Drinker. Sells has 100,000 records, Likes has 1 million records
and Drinker has also 100,000 records. Assume that each block of data (page) holds 100 records.
Recall that block is the smallest addressable u
CS206
HW4
(* due date is probably Nov. 18, 2013)
November 5, 2013
1. A fair die is tossed twice. Let X = the sum of the faces, Y = the maximum of the two faces,
and Z = face 1 face 2.
(a) Write down the value of X ,Y , Z , and W = XZ for each outcome w
336 Project FAQ
1. What should my web interface consist of?
I get this question asked a lot. Here is my answer: Imagine you are pitching your project as a
backend to a web site. What should this web site be to attract users? What are users likely to
ask,
How to translate ER Model to
Relational Model
By: Jung T. Chang
CS 157A T/Th Morning Section
Review  Concepts
Relational Model is made up of tables
A row of table
A column of table
A table
Cardinality
Degree
= a relational instance/tuple
= an attribute
=
Your score:
100
1.
Translate the above E/R diagram to relations, using the "E/R" approach to handling ISA
hierarchies. Then, identify which of the following relations is NOT in the resulting
database schema.
a)
F(c,d)
b)
H(g,h)
c)
E(a,b,c)
d)
E(a,b,c,e)
A
:The following diagram .1
describes a database about bands and their tours. A tour consists of a
sequence of cities visited by a band. We assume that no city is visited
twice on a single tour, and on one date, a band can visit only one city.
Some of the e
Polina Yanovich
yanovich@cs.rutgers.edu
Office hours:
Wednesday 1pm 3pm
CBIM general area to the
right
Show the beers sold at Club 175 or
Eulipia, but not both.
(SELECT beer FROM sells
WHERE bar = 'Club 175')
1_
(SELECT beer FROM sells
WHERE bar = 'Eulipi
CS 336 Quiz #1 v2 Sept 16, 2013
NAME:
_
RUID:_
_
Electronic Devices are not permitted during the quiz. These include but are not restricted to
calculators, computers and cell phones.
No communication between students or anyone outside of class is permitte
Submission number:
Submission certificate:
Submission time:
42470
CG247005
20101014 07:20:56 PST (GMT  8:00)
Number of questions:
Positive points per question:
Negative points per question:
Your score:
8
12.5
0.0
100
1. A bank has a database with accou
DatabaseDesign
x Howtocomeupwithtables?
x Aretheregoodtablesandbad
tables,istheregooddesignandbad
design?
x Yes.
1
Twoschools
x Startfromsemanticmodel,which
describesthedatabaseintermsof
conceptsbeingmodeled
x Oncethemodelingpartisdone
convertconceptstota
336 PROJECT  UPDATED
BarBeerDrinker PLUS
Your objective will be to extend significantly the famous db scheme with new attributes and new
relations. It has to be realistic and interesting. Imagine you are pitching a new company to
investors. You have un
Office hours changed: Wed 1pm3pm,
Hill 266
Relation
Key
drinker
name
bar
frequents
licens
e
sells
drinker
bar
addr
name
phone
likes
drinker
addr
bar
beer
beer
name
manf
Schema
beer
price
Attribute
has a
domain
drinker
Sally
100 something
ave something
to
Midterm
CS206, Spring 2012
Instructions:
1.
2.
3.
4.
This test is CLOSED book, CLOSED notes, NO calculators.
You have 1:20 hours to answer the questions.
You can use both sides of the test book to write your answers.
Show ALL your work. Give a brief expla
Midterm
CS206, Spring 2009
Instructions:
1.
2.
3.
4.
This test is CLOSED book, CLOSED notes, NO calculators.
You have 1:20 hours to answer the questions.
You can use both sides of the test book to write your answers.
Show ALL your work. Give a brief expla
Midterm
CS206, Spring 2005
March 21, 2005
Instructions:
1. This test is CLOSED book, CLOSED notes, NO calculators.
2. You have 1:15 hours to answer the questions.
3. You can use both sides of the test book to write your answers.
4. Show ALL your work. Giv
Final
CS206, Spring 2009
Instructions:
1.
2.
3.
4.
This test is CLOSED book, CLOSED notes, NO calculators.
You have 3:00 hours to answer the questions.
You can use both sides of the test book to write your answers.
Show ALL your work. Give a brief explana
Final
CS206, Fall 2009
Instructions:
1.
2.
3.
4.
This test is CLOSED book, CLOSED notes, NO calculators.
You have 3:00 hours to answer the questions.
You can use both sides of the test book to write your answers.
Show ALL your work. Give a brief explanati
Midterm
CS206, Fall 2009
Instructions:
1.
2.
3.
4.
This test is CLOSED book, CLOSED notes, NO calculators.
You have 1:20 hours to answer the questions.
You can use both sides of the test book to write your answers.
Show ALL your work. Give a brief explana
Final
CS206, Spring 2005
Instructions:
1. This test is CLOSED book, CLOSED notes, NO calculators.
2. You have 2:30 hours to answer the questions.
3. You can use both sides of the test book to write your answers.
4. Show ALL your work. Give a brief explana
CS206  Discrete Structures II
Final Exam  Section 01  Spring 2012
Name:
Student I.D.:
1
Problems
This test is CLOSED book, CLOSED notes, NO calculators. You are allowed one letter size, one side,
cheat sheet.
You have 3:00 hours to answer the questio
Coupon Collectors Problem
Suppose there are n dierent coupons and you need to collect one of each. To collect a coupon you draw
it, at random, from a box that contains innitely many copies of each coupon. How long will you have to
wait, on average, until
Easy questions
#1. As there are 26 characters in alphabet and we have 30
students. Since 30>26, there must be at least two with last names
which begin with the same letter.
#2. When an integer is divided by 4, the remainder can only
display in 4 ways: 0,
SYLLABUS 336  Or 14 steps
program how to become a database
guru
Fall 2013
(pages refer to the second edition of GUW textbook)
The format: Each week, I list the material you need to
read from the book or other sources during that week.
You will be quizzed
University of California
Department of Information and Computer Science
ICS 184 Database Systems
Final Exam
Fall 2000
Max. Points: 125
(Please read the instructions carefully)
Instructions:


Total time for the exam is 2 hours. No extra time will be awa
Find bars where either Tim or John drink.
(SELECT bar FROM Frequents WHERE drinker = 'John') UNION (SELECT bar FROM Frequents WHERE drinker
= 'Tim');
Which bar sells cheapest 'Bud' ?
SELECT bar
FROM sells
WHERE beer = 'Bud' AND price = (SELECT MIN(price)
Beer that has the maximum average price over the bars.
SELECT s.beer FROM sells s
GROUP BY beer
HAVING AVG(price) >= ALL(SELECT beer, AVG(price) AS av_p
FROM sells
GROUP BY beer)
Liers: Drinkers that frequent all the bars that do not serve any beer they
l
Beer that has the maximum average price over the bars.
SELECT s.beer FROM sells s
_ _ _
HAVING AVG(price) _ _ (
SELECT beer, _ (price) AS av_p
FROM sells
_ _ _)
Liers: Drinkers that frequent all the bars that do not serve any beer they
like
SELECT *
FROM