Tuple Relational Calculas

265 views Asked by At

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?)

1

There are 1 answers

0
philipxy On

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 T is an element of some relation defined in terms of given relations to have certain attributes.

  • We take T to name a tuple value that has exactly the attributes that are used after T. on the right.

(Otherwise, any time a tuple value for name T with just attribute sname satisfies 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.a on the left, hence giving both the attribute names and values. Some versions are like one of those but also give a tuple name T on the left.)