GATE CS 2017 Set 1 — Question 41
Go beyond PYQs with Success TrackerAI-powered personalised practice and doubt support. Unlimited practice on eligible plans; AI usage limits apply.MCQ+2 / -0.67MediumTuple Relational CalculusRelational ModelDatabases
Databases → Relational Model → Tuple Relational Calculus
Last updated
Question
Consider a database that has the relation schemas EMP(EmpId, EmpName, DeptId), and DEPT(DeptName, DeptId). Note that the DeptId can be permitted to be NULL in the relation EMP. Consider the following queries on the database expressed in tuple relational calculus.(I)
(II)
(III) Which of the above queries are safe?
(II)
(III) Which of the above queries are safe?
Correct answer
(D) (I), (II) and (III)
Solution
A tuple relational calculus query is safe if it is guaranteed to return a finite result, i.e. every value in every result tuple can be drawn from the database itself.(III) must equal an EmpName in EMP and must equal a DeptId in DEPT. Both values come from finite relations, so (III) is safe.(I) and (II) use (for all in (I), for some in (II)). Read strictly, an inequality does not bind to any database value: in (I) may be any value outside DEPT's DeptIds, and in (II) any value different from at least one of them. Over an unrestricted domain both of these sets are infinite, so on a literal reading (I) and (II) are unsafe and only (III) is safe, which matches none of the options.The official answer. The official GATE 2017 (Set 1) key gives (D), i.e. all three queries are safe. This corresponds to the reading the question intends: is a tuple built from an employee , so its DeptId is the employee's own DeptId (as if the condition were written with ), and the DEPT clause only filters which employees appear (those whose department matches no / some / a DEPT entry, the "NULL DeptId" note being why (I) can be non-empty). Under that reading every output value comes from EMP, the result is a subset of a finite relation, and all three queries are safe.This key is widely disputed, because the printed queries constrain only by inequality in (I) and (II). The official key stands, so the expected answer is (D).
- (A) and (B) each leave out one query; under the intended reading all three are safe.
- (C) excludes (I): under the intended reading (I) is safe, and on the literal reading (II) is unsafe as well, so (C) is not right either way.
- (D) matches the official key.
Continue learning with Success Tracker
A step still unclear? Work through it with support
Use Success Tracker to ask about the reasoning, then try another GATE CS question to check your understanding.
AI-powered practice· Unlimited practice on eligible plans
- PYQs with solutions
- Attempt available previous-year questions, then compare your reasoning with the worked solution. Coverage varies by stream.
- Practice that adapts
- Choose a topic, work on weaker areas and bookmark questions to revisit. Your attempts feed your progress tracking.
- AI doubt support
- Ask follow-up questions about a step or concept while practising, instead of stopping at the final answer.
Unlimited practice is available on eligible plans. Free practice and AI usage have limits; check the current plan allowances before choosing.
This page stays readable without an account. AI responses can be wrong; check them against the solution and source material.
More questions on Relational Model
2026 Set 2 Q15In the context of DBMS, consider the two sets T and S given below. | T | S | |---|---| | I:…2026 Set 2 Q20Consider concurrent execution of two transactions and in a DBMS, both of which access a…2026 Set 1 Q30Let and be the attributes of a relation in a relational schema. Let…2026 Set 1 Q31In the context of relational database normalization, which of the following statements is/are true?2026 Set 2 Q42In the context of schema normalization in relational DBMS, consider a set F of functional…