[Main Page] [Literature] [Software] [People] [Conferences] [Courses] [Web-DB]
Please read the following chapter from the book by Elmasri and Navathe (3rd Edition):
Your results for homeworks, midterm and final exam are stored in a relational database with the following schema:
STUD_ID is simply a sequential number
assigned when the student submits the registration form.
REGISTERED is the date when this row was inserted into the table.
LAST_NAME and FIRST_NAME
together are declared as secondary key.
LAST_TERM is 'Y' if this is the last term of the student,
otherwise it is 'N'.
All attributes except EMAIL, LAST_TERM and GRADE are not null.
This contains three rows,
one for homeworks,
one for the midterm exam,
and one for the final exam.
CAT contains a letter (e.g. 'H'),
CAT_NAME the full name (e.g. 'Homeworks'),
and OUTPUT_ORDER is 1 for homeworks,
2 for the midterm exam,
and 3 for the final exam.
CAT identifies the category of the exercise,
e.g. 'H' if this is a homework exercise,
'M' if this is a midterm exercise,
and 'F' if this exercise is from the final exam.
EX_NO is the number of the exercise.
This table contains how many points a student has got for which exercise. ENTERED is the date when the result was entered into the database. Note that all attributes are not null. There is only an entry for a student X and and exercise Y if X submitted a solution to Y.
Please write the following queries in SQL. You must actually run them in SQL*Plus (or some other SQL system). If your solution contains a syntax error which any DBMS would have found, you get 0 points. In SQL*Plus, you can create a spool file and submit this (see Appendix B). You do not need to submit the query results. You are allowed to use views.
Please submit your solution on next Wednesday (April 5) before the lecture.
Stefan Brass (sbrass@sis.pitt.edu), March 29, 2000
Original URL: http://www2.sis.pitt.edu/~sbrass/db00_2/h9_sql.html [HTML 3.2 Checked]