edited by
10,684 views
61 votes
61 votes

Consider a relation geq which represents "greater than or equal to", that is, $(x,y) \in $ geq only if $y \geq x$.

create table geq
(	
    ib	integer	not null,
    ub	integer	not null,
    primary key ib,	
    foreign key (ub) references geq on delete cascade
);

Which of the following is possible if tuple (x,y) is deleted?

  1. A tuple (z,w) with z > y is deleted
  2. A tuple (z,w) with z > x is deleted
  3. A tuple (z,w) with w < x is deleted
  4. The deletion of (x,y) is prohibited
edited by

5 Answers

0 votes
0 votes
the relation schema is ( lb , ub ), where lb is the primary key, and ub is the foreign key which is referencing the primary key of its own relation.
 
Hence the table geq is both the master ( which has the referenced key ) as well as the child table (which has the referencing key).
 
The table has two constraint, one is that if there is a tuple ( x, y ), then y is greater than or equal to x, And the other is referential integrity constraint, which is on-cascade-delete on the foreign key.
 
On-cascade-delete says, that “When the referenced row is deleted from the other table (master table), then delete also from the child table”.
 
Suppose the instance in the given relation is the following:
 
x y
-----
5 6
4 5
3 4
6 6
Now if we delete tuple (5,6) then tuple ( 4,5 ) should also be deleted ( as 5 in the tuple (4, 5) was referencing to 5 in the tuple(5,6) which no longer exist, hence the referencing tuple should also be deleted), and as (4,5) got deleted hence tuple (3,4) should also be deleted for the same reason.
 
Therefore in total 3 rows have to be deleted if tuple ( 5,6 ) is deleted.
 
Now from the above instance we can say that if (x,y), i.e. ( 5,6 ) gets deleted then a tuple ( z, w) i.e, ( 3, 4) is also deleted. And we can see here that w < x. Hence option C.
Answer:

Related questions

7 votes
7 votes
3 answers
1
go_editor asked Feb 8, 2018
2,025 views
Consider a relation examinee (regno, name, score), where regno is the primary key to score is a real number.Write an SQL query to list the regno of examinees who have a s...
16 votes
16 votes
2 answers
3
Kathleen asked Sep 14, 2014
3,742 views
Consider a relation examinee (regno, name, score), where regno is the primary key to score is a real number.Write a relational algebra using $( \Pi, \sigma, \rho, \times)...
52 votes
52 votes
3 answers
4
Kathleen asked Sep 14, 2014
7,354 views
Let r and s be two relations over the relation schemes R and S respectively, and let A be an attribute in R. The relational algebra expression $\sigma_{A=a}(r \bowtie s)...