Consider the following relational schema.
Students(rollno: integer, sname: string)
Courses(courseno: integer, cname: string)
Registration(rollno: integer, courseno: integer, percent: real)
For the following query:
{T ∣ ∃S∈Students,∃R∈Registration(
S.rollno=R.rollno ∧ R.courseno=107 ∧ R.percent>90 ∧ T.sname=S.sname)}
Will the whole of satisfying tuples be retrieved or only their T.sname? (If so, will it be distinct?)
A relational calculus or algebra expression returns a relation value. Relations hold sets of tuples. Sets do not contain duplicates.
The attributes in the result depend on how your particular version of tuple relational calculus is defined. Two reasonable possibilities are:
The right hand side says that the tuple value named
Tis an element of some relation defined in terms of given relations to have certain attributes.We take
Tto name a tuple value that has exactly the attributes that are used afterT.on the right.(Otherwise, any time a tuple value for name
Twith just attributesnamesatisfies the right hand side, every other tuple with any additional attributes whatsoever with any values whatsoever also satisfies the right hand side.)(Some versions of tuple relational calculus give just the attribute names on the left. Some versions give the attribute names plus values (in terms of tuple names used on the right) on the left. Some versions give expressions of the form
R.aon the left, hence giving both the attribute names and values. Some versions are like one of those but also give a tuple nameTon the left.)