Tuple Relational Calculus is a non-procedural query language. It specifies what to retrieve, not how to retrieve it. A TRC query defines a set of tuples that satisfy a predicate rather than describing an explicit sequence of operations.
The general form of a TRC query is:
{ t | P(t) }
where:
Typical atomic predicates are of the forms t ∈ R (t is a tuple of relation R) and t[A] Θ value or t[A] Θ s[B] where Θ is a comparison operator (=, ≠, <, ≤, >, ≥).
Logical connectives used in predicates include AND (∧), OR (∨), and NOT (¬). TRC also uses quantifiers over tuple variables:
Free tuple variables in the outermost expression determine the schema of the resulting relation. An expression with no free tuple variables returns a relation with zero attributes (a truth value as an empty tuple), but in practice we use free tuple variables to select attributes for the result.
Schema and sample relations:
Table-1: Customer

Table-2: Branch

Table-3: Account

Table-4: Loan

Table-5: Borrower

Table-6: Depositor

Queries-1: Find the loan number, branch and amount of loans whose amount is greater than or equal to 10000.
{ t | t ∈ loan ∧ t[amount] >= 10000 }
Resulting relation:

In this query the tuple variable t ranges over tuples of relation loan; t[amount] denotes the amount attribute of t.
Queries-2: Find the loan number for each loan whose amount is greater than or equal to 10000.
{ t | ∃ s ∈ loan (t[loan-number] = s[loan-number] ∧ s[amount] >= 10000) }
Resulting relation:

Queries-3: Find the names of all customers who have both a loan and an account at the bank.
{ t | ∃ s ∈ borrower (t[customer-name] = s[customer-name]) ∧ ∃ u ∈ depositor (t[customer-name] = u[customer-name]) }
Resulting relation:

Queries-4: Find the names of all customers who have a loan at the "ABC" branch.
{ t | ∃ s ∈ borrower (t[customer-name] = s[customer-name] ∧ ∃ u ∈ loan (u[branch-name] = "ABC" ∧ u[loan-number] = s[loan-number])) }
Resulting relation:

Domain Relational Calculus is another non-procedural query language. Instead of tuple variables, DRC uses domain variables that range over atomic domain values (attribute values). A DRC query returns tuples of domain values that satisfy a predicate.
The general form of a DRC query is:
{ < x1, x2, ..., xn > | P(x1, x2, ..., xn) }
where each xi is a domain variable and P is a predicate built from:
Schema and sample relations:
Table-1: Customer

Table-2: Loan

Table-3: Borrower

Query-1: Find the loan number, branch and amount of loans with amount greater than or equal to 100.
{ <l, b, a> | <l, b, a> ∈ loan ∧ (a ≥ 100) }
Resulting relation:

Query-2: Find the loan number for each loan whose amount is greater than or equal to 150.
{ <l> | ∃ b, a ( <l, b, a> ∈ loan ∧ a ≥ 150 ) }
Resulting relation:

Query-3: Find the names of all customers having a loan at the "Main" branch and report the loan amount.
{ <c, a> | ∃ l ( <c, l> ∈ borrower ∧ ∃ b ( <l, b, a> ∈ loan ∧ b = "Main" ) ) }
Resulting relation:

Note: Domain variables that appear in the result must be listed before the bar (|) inside < and >. The order of variables in the resulting tuple should correspond to the attribute order used in predicates or to the target schema expected by the query.
For a calculus expression to be usable in practice it must be safe (also called range-restricted). Safety guarantees the result is finite and depends only on the active domain (the set of values actually present in the database), not on some infinite underlying domain.
Typical conditions ensuring safety:
Safe and domain-independent expressions correspond to relational algebra queries and can be translated to SQL (without aggregation or recursion).
Translations follow these general ideas:
t ∈ R or <v1,...,vn> ∈ R corresponds to using the relation R in the algebra expression.Example idea (informal translation):
For the TRC query { t | t ∈ loan ∧ t[amount] >= 10000 } the translation to relational algebra is:
Select tuples from loan where amount >= 10000. In SQL:
SELECT loan-number, branch-name, amount FROM loan WHERE amount >= 10000;
Summary
Tuple and Domain Relational Calculus are declarative formalisms that describe the set of desired tuples or attribute values using predicates and quantifiers. When expressions are safe, both calculi are equivalent to relational algebra and can be implemented using SQL. Key practical skills are expressing queries correctly in both calculi, checking range-restriction (safety), and translating calculus expressions to algebra/SQL for execution.
| 1. What is Tuple Relational Calculus (TRC) in DBMS? | ![]() |
| 2. How does Tuple Relational Calculus differ from Domain Relational Calculus? | ![]() |
| 3. What are the advantages of using Tuple Relational Calculus? | ![]() |
| 4. Can Tuple Relational Calculus be used for complex queries? | ![]() |
| 5. Is Tuple Relational Calculus widely used in practice? | ![]() |
![]() | Explore Courses for Computer Science Engineering (CSE) exam |
![]() | Get EduRev Notes directly in your Google search |