Skip to content
Official PYQ · 2001

GATE CS 2001 Q2.25 — Tuple Calculus and SQL

Explain with AI

Consider a relation geq which represents "greater than or equal to", that is, (x,y)∈(x,y) \in geq only if y≥xy \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?

Choose one option
View worked solution

Answer: C

In the relation geq, the primary key is ib and the foreign key is ub, which references ib. The relation represents the "greater than or equal to" condition, meaning for any tuple (u,v)(u, v), we must have v≥uv \geq u.

When we delete the tuple (x,y)(x, y):

  1. The primary key xx is deleted.
  2. Due to ON DELETE CASCADE, any tuple with foreign key ub =x= x must also be deleted. Let this tuple be (w,x)(w, x). Since (w,x)∈geq(w, x) \in \text{geq}, we have x≥wx \geq w. If w≠xw \neq x, then w<xw < x.
  3. Deleting the tuple (w,x)(w, x) means its primary key ww is deleted.
  4. This deletion cascades to any tuple (z,w)(z, w) whose foreign key is ww.

Since w<xw < x, the deleted tuple (z,w)(z, w) satisfies the condition w<xw < x. Therefore, it is possible that a tuple (z,w)(z, w) with w<xw < x is deleted.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Tuple Calculus and SQL questions