Assignment 10
Contents:
Overview
Topic: Databases
Related Reading: Ch. 12 and notes
Due: 9am Wednesday, 7 August 2002
Internet Requirements
You will need an Internet connection for completing the assignment as
well as submission.
Practice Problems
If the above site is not responding well, a copy of some of the information can be found at
http://burks.brighton.ac.uk/burks/language/other/gisql/home.htm, though that site does not let you interact with a true database.
Problems to be Submitted (20 points)
- (6 points)
For this problem, consider the tables Movie, Customer and Rents
from pp. 385-387 of the text (not to be confused with the Internet movie database from the "Gentle Introduction to SQL" which we will use in later questions).
- What would the output be of the following SQL query:
SELECT Title,MovieId
FROM Movie
WHERE Rating = 'R' OR
Genre like '%drama%'
- What would the output be of the following SQL query:
SELECT Name, MovieId, DateRented
FROM Customer,Rents
WHERE Customer.CustomerID = Rents.CustomerID
- What would the output be of the following SQL query:
SELECT Title, DateRented
FROM Movie,Customer,Rents
WHERE Movie.MovieId = Rents.MovieId AND
Customer.CustomerID = Rents.CustomerID AND
Customer.Name = 'Randy Wolf'
- (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.
- (4 points)
At the end of Ch. 12 there are a series of "Thought Questions" (p. 397).
Pick any one question to answer. The length of your answer
should be appropriate for the question, however I envision answers in
the range of 1/2-page to 1-page.
Overall, please type your answers to all of the problems in a
single document to be submitted electronically. Please see details about the
submission process.
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:
ns121 Class Page
visprof@coloradocollege.edu