I am trying to learn Domain relational calculus. Considering the below relations and queries, why can't we write for{<c>|< b, l, c, a> ∈ borrow ∧ a>1200} the second question? I have a feeling that it has something to do with whether the query is safe, but how come the answer for question one works? I don't know what exactly is wrong. Could you please help to explain? Many thanks!
Source from http://www.cs.sfu.ca/CourseCentral/354/zaiane/material/notes/Chapter3/node18.html#SECTION00142000000000000000
and the relations it refers to is here http://www.cs.sfu.ca/CourseCentral/354/zaiane/material/notes/Chapter3/node8.html#SECTION00121000000000000000
Asked
Active
Viewed 264 times
0
Alnitak
- 334,560
- 70
- 407
- 495
user3735871
- 527
- 2
- 14
- 31
1 Answers
1
Remember, that the definition of query in Domain Relational Calculus
{<x1, ..., xn> | P(<x1, ..., xn>)}
says that the variables x1, ..., xn that appear to the left of ‘|’ must be
the only free variables in the formula p(...). In your example, variables b,l,a are not bound and remain free. In the correct answer, the existence quantifier binds them.
Mosha Pasumansky
- 13,206
- 5
- 32
- 55
-
Thank you! So by using the "Exist" notation, "b,l,a" are bounded? – user3735871 Mar 30 '15 at 23:03
-
1Yes, Exist (as well as All) bind its variables – Mosha Pasumansky Mar 30 '15 at 23:11