Due: Thursday, August 17
Please upload your solutions using CSNS. Note that file uploading will be disabled automatically after 11:59PM of the due date, so please turn in your work on time.
[Reading]
[Stored Procedures and Triggers]
Consider the following schema:
The class_level attribute in the Students relation could be B1, B2, B3, B4, or G, which represents freshman, sophomore, junior, senior, or graduate student. The day_of_week attribute in the Classes relation could be SUN, MON, TUE, WED, THR, FRI, or SAT.
1. (20pt) Create the relations in the Oracle database with proper attribute types and constraints (primary key, unique, foreign key, and not null). Populate the tables so that you have sufficient data to test the procedures and triggers you'll implement in the next two exercises. For this exercise, turn in an SQL script file hw3-tables.sql which include the SQL statements you use to create and populate the tables.
2. (40pt) Implement the following procedures/functions using PL/SQL:
For this exercise, turn in a script file hw3-procedures.sql which includes the code to implement the procedures/functions, as well as test code to show that they work properly.
3. (40pt) Implement the following integrity constraints. For each constraint, briefly explain what operation(s) (inserts, deletes, and updates on specific relations) must be monitored to enforce the constraint.
For this exercise, turn in a script file hw3-triggers.sql which includes the PL/SQL code to implement the constraints, test code to demonstrate the constraints are enforced properly, and the discussion about what operation(s) to monitor as code comments.