FINAL
CS422, Summer 2004


Please turn in a hard copy of your solutions at the end of the exam, and upload all your files using the turnin server. Note that both hard copy and electronic copy are required, and file uploading will be disabled at 10:10PM.


Consider a database ClassInfo which consists of following relations:

[Schema Creation]  (20pt) Create the relations in a DBMS using the CREATE TABLE statement. Use proper data types and column/table constraints.

[Triggers] (40pt) Write triggers to enforces the following constraints:
[Functions] (30pt) Implement the following functions:
0.3*midterm_points/midterm_total + 0.3*final_points/final_total + 0.4*other_assignment_points/other_assignments_total
'A', if grade_percentage >= 0.85
'B', if grade_percentage < 0.85 and grade_percentage >= 0.7
'C', if grade_percentage < 0.7 and grade_percentage >= 0.6
'D', if grade_percentage < 0.6 and grade_percentage >= 0.45
'F', if grade_percentage < 0.45
[Queries] (20pt) Write a query for each of the following problems:
[JDBC] (extra credit 30pt) Write a Java program TriggerTest.java to test your triggers. In particular, the program perform the following operations:
If you forgot how to do file I/O in Java (or don't know how to do it in the first place), you may hard-code the tuples in your Java program as an array, and lose 5pt for doing that.