INFO I101 Lab 6
Databases
Due date: to be announced
50 points
Due date: to be announced
50 points
This is DRAFT version 2.3.1, revised 2014 March 8.
We will create and query a movie database.
Objectives — learn to:
Create a database of films directed by Alfred Hitchcock. The four database tables and their attributes are as follows:
Remarks:
| filmid | actorid |
|---|---|
| f1 | a1 |
After creating the tables, populate them with the data shown below. You may create forms for data entry or simply use the datasheet view of each table.
Data for the tables: see Hitchcock movie data (one-page PDF).
It will be a good idea to define the following views to make the queries and reports easier:
Microsoft Office Access users: Access has no notion of a "view" as distinct from a "query." Just save the queries below, with the names "filmStudioView" and "filmCastView".
The "filmStudioView" view, based on the query:
select filmid, released, title, runtime, studio.studioid as studioid, studioname from film, studio where film.studioid = studio.studioid;
or this equivalent query
select filmid, released, title, runtime, studio.studioid as studioid, studioname from film inner join studio on film.studioid = studio.studioid;
The "filmCastView" view, based on the query:
select film.filmid as filmid, released, title, runtime, actor.actorid as actorid, actorname from film, actedIn, actor where film.filmid = actedIn.filmid and actedIn.actorid = actor.actorid;
or this equivalent query
select film.filmid as filmid, released, title, runtime, actor.actorid as actorid, actorname from film inner join actedIn on film.filmid = actedIn.filmid inner join actor on actedIn.actorid = actor.actorid;
After populating the tables, create the reports specified below. Use the report wizard to design the report; you may tweak the design if you wish. Print the output of each report.
title and released,
and the name of the studio that made it.
Sort the films by released
in ascending order.select title, released, studioname from filmStudioView;
actorname as the primary sort field,
and released as the
secondary sort field, both in ascending order.select actorname, released, title from filmCastView;
For each of these problems, formulate a query in either SQL or QBE to answer the question. Print the query definition (SQL view, or Design View for QBE). Run the query, and print its output.
Note: You may capture the code and output by copying and pasting them into a text editor or word processor, or by capturing a screenshot. You may wish to do this to save paper, and/or you may be forced to do it because the database system does not allow you to print the queries directly.
See How to take a screenshot (with instructions for several operating systems).
Query problems:
Turn in these items, stapled together, in the order indicated:
Student name: ___________________________________________
| Item | Points |
|---|---|
| Correct table definition and data entry for the film and studio tables, as shown by the output of the Film and Studio Report. | 10 |
Film and Studio report is sorted by released
in ascending order. |
5 |
| Correct table definition and data entry for the actedIn and actor tables, as shown by the output of the Cast Report. | 10 |
Cast Report is sorted by actorname,
then released, in ascending order. |
5 |
| Correct queries (SQL code and query output). Four queries, 5 points each. | 20 |
| TOTAL | 50 |
Raw total of 50 will be scaled to 20 points (multiply by 20/50).