Consider the relations R(w, x, y, z) and S(a, b). For each of the following constraints on R, state which of insert/update/delete trigger(s) are needed, and give a trigger that enforces the constraint (if multiple triggers are needed, you only need to give one): 1. Primary key is (w,x) 2. y must be unique 3. z must not be null 4. wx -> yz *and* y -> x (BCNF violation) 5. y is a foreign key on S(a) (assume S does not change). 6. For any given (w,z), no change to R may cause the number of matching rows to drop below 3. 7. Changes are not allowed to alter a row's primary key in R. 8. Challenger: suppose we have the following view: create view T as select R.*, S.b from R join S on x=a; ... with R.x a foreign key reference to S.a. Define a trigger that allows an attempted insert on T to create new rows in R and S, as long as neither primary key exists yet (in which case the attempt to insert into a view is well-defined). In other words, given the data below, attempts to insert T(1,2,3,4,5) or T(3,4,5,6,7) should fail but T(5,6,7,8,9) should succeed and create new rows R(5,6,7,8) and S(6,9): R(w,x,y,z) S(a,b) =========== ======= 1 2 3 4 2 5 1 4 5 6 4 7