Question: Question 2. Consider the following relations: Relation R1 Relation R2 Relation R3 Relation R4 Relation R5 Primary Keys: 1. Relation R1: A,B 2. Relation R2:


Question 2. Consider the following relations: Relation R1 Relation R2 Relation R3 Relation R4 Relation R5 Primary Keys: 1. Relation R1: A,B 2. Relation R2: D 3. Relation R3: M,N,O 4. Relation R4: J,K 5. Relation R5: S The following foreign key constraints are given for relations R1, R2, R3, R4 and R5: 1. R3(MN) references R1(AB) 2. R3(O) references R2(D) 3. R1(C) references R5(S) 4. R(J) references RS(S) 5. R4(K) references R2(D) Assume - "CASCADE" policy for delete operations, and - "SET NULL" policy for update operations. a) (10pts) For the operations given below, indicate whether execution of the operation would violate some "primary key" or "integrity constraints". If your answer is yes, specify the constraints (from the above list) that would be violated. i) Insert tuple (a1,b10, d20, 35) into R3. ii) Insert tuple (s500, d20, 75) into R4. b) (15pts) For the operations given below, indicate whether execution of the operation would violate any "foreign key constraints". If your answer is yes, specify the constraints (from the above list) that would be violated. Apply "CASCADE" policy for delete operations, and apply "SET NULL" policy for update operations. Update the tables after applying those policies. (You may either redraw the tables or mention which tuples/attributes are deleted/updated at each table. For updates rewrite the updated tuples.) Make the changes on the original tables for each operation below. i) Delete tuple (d30, 150, 300) from R2. ii) Update tuple (s400,30,555) in R5 with values (6000,60,66) iii) Update tuple (s100, 20,555) in R5 with values (6000,60,666) c) (5pts) If all tuples in R5 are deleted, what tuples will R2 and R3 contain
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
