CS FundamentalsModerateProduct placement · DBMS interview

Which tuple relational calculus expression is UNSAFE (may produce an infinite result)?

  1. A. { t | Emp(t) ∧ ¬ ∃ m (Emp(m) ∧ m.boss = t.id) }
  2. B. { t | ¬ Emp(t) }
  3. C. { t | Emp(t) ∧ t.salary > 50000 }
  4. D. { t.name | Emp(t) ∧ ∃ d (Dept(d) ∧ d.id = t.dept) }

Correct answer: B. { t | ¬ Emp(t) }

{ t | ¬ Emp(t) } asks for every possible tuple not in Emp, which is infinite. The others draw t from Emp, so their results are finite.

More DBMS and SQL questions

Exams that ask this topic