Which of the following relational calculus expressions is not safe?

2001

Which of the following relational calculus expressions is not safe?

GATECS2000Q49
  1. A.

    {t | ∃u ∈ R1 (t[A] = u[A]) ∧ ¬∃s ∈ R2 (t[A] = s[A])}

  2. B.

    {t | ∀u ∈ R1 (u[A] = "x" ⇒ ∃s ∈ R2 (t[A] = s[A] ∧ s[A] = u[A]))}

  3. C.

    {t | ¬(t ∈ R1)}

  4. D.

    {t | ∃u ∈ R1 (t[A] = u[A]) ∧ ∃s ∈ R2 (t[A] = s[A])}

Attempted by 22 students.

Show answer & explanation

Correct answer: C

A relational calculus expression is safe only when its result is restricted to values from the active database domain, so it cannot generate an infinite set of arbitrary tuples.

Option C is {t | ¬(t ∈ R1)}. This asks for all tuples t that are not in R1. Since t is not positively range-restricted by any relation or finite domain, the result can include infinitely many tuples outside the database. Therefore, option C is not safe.

The other expressions range-restrict t through equality with values coming from R1 and/or R2, so their results are bounded by database values. Hence, option C is correct.

Explore the full course: Gate Guidance By Sanchit Sir