CSE Roadmap

Common tier · about 3 hours · 5 parts

Part 3 of 5 · 1 min read

Tuple relational calculus

Describing a result as a set of tuples satisfying a formula.

Think of describing a guest list not as "walk down this list and copy these names," but as "anyone who satisfies this rule belongs on the list."

In plain words: tuple relational calculus describes a query as { t | P(t) }, read as "the set of tuples t such that condition P is true for t." The condition P can test a tuple's attributes, and can combine tests with AND, OR and NOT.

A worked example. Every order placed by customer 107, as tuple relational calculus.

The key lines.

{ t | t ∈ orders ∧ t.customer_id = 107 }
SELECT * FROM orders WHERE customer_id = 107;

Tuple relational calculus

Tuple relational calculus expresses a query as { t | P(t) }, the set of whole tuples t satisfying a condition P, drawn from one or more named relations.

Example: { t | t ∈ orders ∧ t.customer_id = 107 } describes exactly the rows a matching SQL WHERE clause would return.