0
$\begingroup$

Consider the query:

Find all students who have taken all courses offered in the Biology department

In the book the query is given as:

$\{t\ | \ \exists r \in student \ (r[ID] = t[ID]) \ \land \ (\forall u \in course \ (u[dept\_name]\ = \ "Biology" \ \Rightarrow \exists s \in takes(t[ID] = s[ID] \ \land s[course\_id] = u[course\_id]))\}$

Now I have two questions here :

1) $t$ is a free variable and thus any tuple(including those not in the mentioned relations) can be represented using $t$. But how is it guaranteed that $t$ will only contain the attribute $ID$? Are we defining $t$ to contain $ID$ only and the way to do that is by using $r[ID] = t[ID]$ ?

2) Why is it necessary to include $t[ID] = s[ID]$? And is the value of this $t[ID]$ the same as in $r[ID] = t[ID]$?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.