Curated · Tuple Calculus

MCQ · 1 mark · Problem DBMS-RELM-0105

Consider \(\text{Emp}(\text{eid}, \text{name}, \text{dno})\) with key eid and \(\text{Dept}(\text{dno}, \text{city})\) with key dno. Which relational algebra expression is equivalent to the following tuple calculus query?\[\{\, t \mid \exists e \in \text{Emp}\ \big(t[\text{name}] = e[\text{name}] \land \exists d \in \text{Dept}\ (d[\text{dno}] = e[\text{dno}] \land d[\text{city}] = \text{Pune})\big) \}\]
  1. A
    \(\pi_{\text{name}}\big(\sigma_{\text{city} = \text{Pune}}(\text{Emp} \bowtie \text{Dept})\big)\)
  2. B
    \(\pi_{\text{name}}(\text{Emp}) - \pi_{\text{name}}\big(\sigma_{\text{city} \neq \text{Pune}}(\text{Emp} \bowtie \text{Dept})\big)\)
  3. C
    \(\pi_{\text{name}}\big(\sigma_{\text{city} = \text{Pune}}(\text{Emp} \times \text{Dept})\big)\)
  4. D
    \(\pi_{\text{name}}(\text{Emp} \bowtie \text{Dept}) - \pi_{\text{name}}\big(\sigma_{\text{city} \neq \text{Pune}}(\text{Emp} \bowtie \text{Dept})\big)\)

Solve it on GATE DA practice →More Relational Model & SQL problems

Show the worked solution\[\boxed{\exists e \in \text{Emp}\ \exists d \in \text{Dept}\,(e[\text{dno}] = d[\text{dno}] \land \dots) \;\equiv\; \text{Emp} \bowtie \text{Dept}}\]The query returns the names of employees whose department is located in Pune: join on dno, select city \(=\) Pune, project name — option A.(B) also returns employees whose dno matches no department, and drops a name if another employee with that name works outside Pune.(C) has no join condition: if any Pune department exists it returns every employee name.(D) drops a name shared by one employee in Pune and another employee elsewhere.Answer: A

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com