[Main Page]      [Literature]      [Software]      [People]      [Conferences]      [Courses]      [Web-DB]

 

UNIVERSITY OF PITTSBURGH
School of Information Sciences

INFSCI 2710 - Database Management

(Spring 2000, CRN 20727)


Homework Assignment #4:    Basic Queries in Algebra and SQL


Exercise 4 (12 Points)

Consider a database with information about classical music CDs. It consists of the following tables:

An SQL file will be made available at http://www2.sis.pitt.edu/~sbrass/db/cd.sql which contains the table declarations and some example data. After you downloaded it, you can execute it in SQL*Plus with the command "@cd" (if it is in the current directory) or e.g. "D:\cd" (if it is stored in "D:\cd.sql").

Please write relational algebra expressions to answer the following queries. Note that SQL*Plus does not understand relational algebra, so you cannot test your queries.

    a)
Print all conductors from whom there are recordings in the database.
    b)
Which CDs have over 60 minutes runtime per disc? Please print the name of the CD, the number of discs, and the total runtime. ("Minutes" is the total runtime, "Discs" is the number of CDs, e.g. 2 for a double CD.)
    c)
Which CDs contain a music piece by Prokofiev? ("Prokofiev" is the last name of the composer.) Print number and name of the CD.

Now write the following queries in SQL. You should try to test your queries in SQL*Plus, but it is not required (for this homework). If you want, you can submit a handwritten solution:

    d)
As a). Please make sure that there are no duplicates in the output.
    e)
As b). Please sort the output by the number of CDs as main criterion, and the total runtime as secondary criterion (larger numbers first).
    f)
Please print composer numbers and piece titles for all pieces which contain "Sinfon" or "Symphony" as a substring in their title.

Due Date:

Since we didn't finish the treatment of the relational algebra, this homework is only due on Wednesday in two weeks (February 16) before the lecture.


Stefan Brass (sbrass@sis.pitt.edu), February 2, 2000

Original URL: http://www2.sis.pitt.edu/~sbrass/db00_2/h4_algeb.html   [HTML 3.2 Checked]