Relational calculus has two main forms: Tuple Relational Calculus (TRC) and Domain Relational Calculus (DRC). Both are declarative languages that describe what data to retrieve using logical expressions, but they differ in what kind of variables they use.

Understanding these two variants helps you see how the same query can be written in different styles, and how they match the way SQL and other query languages are designed.

Tuple Relational Calculus (TRC)

In Tuple Relational Calculus, the variables range over entire tuples (rows) of a relation.

A typical TRC expression has the form:

  • {tP(t)}\{ t \mid P(t) \}

    • tt: a tuple variable that ranges over tuples of some relation.

    • P(t)P(t): a logical condition (predicate) that the tuple must satisfy.

The result is the set of all tuples tt for which P(t)P(t) is true.

Example in TRC Style

Suppose we have a relation EMPLOYEE(emp_id, name, salary, dept).

A TRC query for all employees with salary > 50000 can be written informally as:

“Find all tuples tt in EMPLOYEE such that t.salary>50000t.salary > 50000.”

This directly describes the condition on the tuple, without specifying how the database finds it.

Key Features of TRC

  • Variables range over tuples, not individual attribute values.

  • Easy to read when thinking about “rows that satisfy a condition”.

  • Forms the conceptual basis for many SQL queries, especially simple SELECT ... FROM ... WHERE patterns.

Domain Relational Calculus (DRC)

In Domain Relational Calculus, the variables range over individual attribute values (domains) instead of whole tuples.

A typical DRC expression has the form:

  • {x1,x2,,xnP(x1,x2,,xn)}\{ \langle x_1, x_2, \dots, x_n \rangle \mid P(x_1, x_2, \dots, x_n) \}

    • x1,x2,x_1, x_2, \dots: domain variables (values from the domains of attributes).

    • P(...)P(...): a logical condition using these variables.

The result is the set of all value combinations x1,x2, \langle x_1, x_2, \dots \rangle that satisfy the condition.

Example in DRC Style

Again using EMPLOYEE(emp_id, name, salary, dept), the same query (salary > 50000) can be written in DRC‑style as:

“Find all combinations e,n,s,d\langle e, n, s, d \rangle such that there exists a tuple (e,n,s,d)(e, n, s, d) in EMPLOYEE and s>50000s > 50000.”

Here, ee stands for emp_id, nn for name, ss for salary, and dd for dept.

Key Features of DRC

  • Variables range over attribute values, not whole tuples.

  • Useful for expressing conditions that depend on multiple individual fields.

  • Closer in spirit to the way some SQL conditions are written over specific columns.

Relationship Between TRC and DRC

  • Both TRC and DRC are equivalent in expressive power to relational algebra: any query expressible in one can be expressed in the others.

  • TRC is often easier to read for tuple‑based conditions (“all employees where salary > 50000”).

  • DRC is better suited for queries that reason explicitly over attribute values and domains.

Why TRC and DRC Matter?

  • They show how declarative queries can be written in a logical, mathematical way, independent of physical storage.

  • They help explain the semantic foundation of SQL and other query languages.

  • For beginners, TRC is usually introduced first because it feels closer to “tuples that satisfy a condition”, while DRC is studied later to deepen understanding of how values are manipulated.