Assignment 08
Contents:
Overview
Topic: Databases
Related Reading: Ch. 9.1, 9.3 of [Br], as well as notes from
lecture09.
Due: 8pm Monday, 12 November 2001
Internet Requirements
You will need an internet connection to do most of this work.
Practice Problems
Problems to be Submitted (20 points)
- (4 points)
Chapter 9 Review Problem 8 (p. 429 [Br])
- (3 points)
Chapter 9 Review Problem 9 (p. 429 [Br])
- (3 points)
Chapter 9 Review Problem 10 (p. 429 [Br])
- (4 points)
Consider the cia database of countries.
For each of the following queries, give a SQL statement which would
retrieve the desired result:
- Display the name, population, area and gdp of 'Afghanistan'
- Give the name, population and gdp of all countries with region
'North America' or with region 'South America'.
- Find each country which has a population of more than 1000
times its area (in square kilometers), displaying the
name, area and population of such countries.
- Give the name and area of each country of Africa with area
that is either greater than 1 million square kilometers or
less than less than 5000 square kilometers.
NOTE: you do NOT need to include the displayed results in your
submission; only the SQL statement used.
- (6 points)
Consider the movie database.
For each of the following queries, give a SQL statement which would
retrieve the desired result:
-
Display the title, score and number of votes for all movies from 1996 which received a
viewer score of 7.65 or better.
-
Display the actors' names and ord values for the cast members of 'Caddyshack' who have
ord values of 5 or less.
-
Find all movies that included either 'Brad Pitt' or 'Jennifer Aniston' in
the cast, listing the title of the movie and the name of either Brad
or Jennifer, whomever was in the movie.
NOTE: you do NOT need to include the displayed results in your
submission; only the SQL statement used.
Overall, please place your answers to all of these questions in a
single document to be submitted.
Extra Credit (4 points)
We want you to consider how you could find all movies which
included both 'Dan Aykroyd' and 'Chevy Chase' in the cast.
It may seem that a simple change to your answer from (5c) might
suffice for this question, but if you try such a simple change, you
will probalby see that it does not work (do you understand why not?).
Instead, we will approach this in two stages:
comp150 Class Page
mhg@cs.luc.edu
Last modified: 3 November 2001