Which of the following relational calculus expression is not safe?
GATE CSE 2001Databases › Relational Algebra & CalculusVerified
GATE CSE 2001 PYQ: Which of the following relational calculus expression is not safe?
- A
- BCorrect answer
- CCorrect answer
- D
Answer
(B, C) { t ∣ ∀ u ∈ R 1 ( u [ A ] = " x " ⇒ ∃ s ∈ R 2 ( t [ A ] = s [ A ] ∧ s [ A ] = u [ A ] ) ) } \left\{ t \mid \forall u \in R_1\left(u[A]="x" \Rightarrow \exists s \in R_2\left(t[A] = s[A] \land s[A] = u[A]\right)\right) \right\} { t ∣ ∀ u ∈ R 1 ( u [ A ] = " x " ⇒ ∃ s ∈ R 2 ( t [ A ] = s [ A ] ∧ s [ A ] = u [ A ] ) ) }; { t ∣ ¬ ( t ∈ R 1 ) } \left\{t \mid \neg (t \in R_1)\right\} { t ∣ ¬ ( t ∈ R 1 ) }
Approach
Use the standard definition of safety in tuple relational calculus: an expression is safe if its result is finite and all values in the result come from the active domain (constants in the expression plus values appearing in the referenced relations). Evaluate each option against this criterion.
Both B and C violate the safety condition: B can yield an infinite set due to vacuous universal quantification, and C returns all tuples outside R1, which is infinite. Therefore, the correct answer is B and C.
Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.