Tuple Relational Calculus in a DBMS

  • Thread starter momentum
  • Start date
  • Tags Tags
    Calculus
5 replies · 2K views · last reply
momentum
Messages
111
Reaction score
0
<Moderator's note: Moved from a technical forum and thus no template.>

I'm solving a problem using tuple relational calculus ( TRC) in DBMS.

Problem
Find the name of all the employees who work for XYZ Bank Corporation.

Solution ( as given in my book)

Handwritten tuple relational calculus expression: {t | ∃S ∈ WORKS (t[emp_name] = S[emp_name] ∧ S[comp_name] = "XYZ Bank Corporation")}, with a red arrow pointing to a handwritten note asking why S is used instead of t.


I don't understand why book is using S . We have t . Since both of them represents tuples , we could just use t in place of S and get moving.

Can anyone please explain why we required S ?
 
Attachments
  • Handwritten tuple relational calculus expression: {t | ∃S ∈ WORKS (t[emp_name] = S[emp_name] ∧ S[comp_name] = "XYZ Bank Corporation")}, with a red arrow pointing to a handwritten note asking why S is used instead of t.
    tKsmNP0.png
    27.2 KB · Views: 534
Last edited by a moderator:
t is a tuple that contains only the name of an employee, so it is not a member of WORKS. I think the exporesson for the query should start with {t : {emp_name} | ∃S ∈ WORKS ...
 
willem2 said:
t is a tuple that contains only the name of an employee, so it is not a member of WORKS. I think the exporesson for the query should start with {t : {emp_name} | ∃S ∈ WORKS ...
It returns t or S ?
 
momentum said:
It returns t or S ?

The entire expression {t: {emp_name} | ∃ S ∈ WORKS ( ... ) } defines a relation that is a set of tuples with just one attribute. (only the names of the employess of XYZ). t is used, because we only want the employee names, not the comp_names
 
willem2 said:
The entire expression {t: {emp_name} | ∃ S ∈ WORKS ( ... ) } defines a relation that is a set of tuples with just one attribute. (only the names of the employess of XYZ). t is used, because we only want the employee names, not the comp_names
okay ...my confusion here is ,
we call t as tuple.
do we also call S as tuple here ? Yes/No ?
 
momentum said:
okay ...my confusion here is ,
we call t as tuple.
do we also call S as tuple here ? Yes/No ?
S is an element of the WORKS relationship, so it must be a tuple.
 
  • Like
Likes   Reactions: momentum