Qinglian
• Home Page
• Assignments Due • Progress Report
• Handouts
• Tutorials
• Homeworks
• Lab Projects
• Log Out
Help
Copyright © 2007-2021 Gradiance Corporation.
Gradiance Online Accelerated Learning
Spring-21 HW5
Number of questions: 2 Positive points per question: 14.0 Negative points per question: 0.0
1. Here are declarations of two relations R and S: CREATE TABLE S(
c INT PRIMARY KEY,
d INT
);
CREATE TABLE R(
a INT PRIMARY KEY,
b INT REFERENCES S(c) );
R(a,b) currently contains the four tuples (0,1), (7,1), (3,3), and (9,9). S(c,d) currently contains the four tuples (1,4), (7,8), (9,4), and (3,1). Which of the following modifications will not violate any constraint:
a) Inserting (3,0) into S
b) Deleting (7, 1) from R
c) Inserting (9,1) into R
d) Inserting (1,5) into R
2. Here are declarations of two relations R and S:
CREATE TABLE S(
c INT PRIMARY KEY,
d INT
);
CREATE TABLE R(
a INT PRIMARY KEY,
b INT,
CHECK(b IN (SELECT c FROM S))
);
R(a,b) currently contains the four tuples (0,4), (1,5), (2,4), and (3,5). S(c,d) currently contains the four tuples (2,10), (3,11), (4,12), and (5,13). As a result, certain insertions and deletions on S are illegal, as are certain updates or insertions on R. You should develop simple tests for illegal operations of these four kinds. Then, show your understanding by indicating which of the following modifications will not be rejected because of a constraint violation.
a) Updating (2,4) in R to be (2,8).
b) Updating (1,5) in R to be (1,10).
c) Updating (3,5) in R to be (3,1).
d) Updating (3,5) in R to be (3,3).
Submit Homework