Tuple Relational Calc
Tuple Relational Calc
DBMS
Tuple Relational Calculus (TRC) in DBMS
Tuple Relational Calculus (TRC) is a non-procedural query language used in relational database
TRC is based on the concept of tuples, which are ordered sets of attribute values that represent a
TRC is a declarative language, meaning that it specifies what data is required from the database,
rather than how to retrieve it. TRC queries are expressed as logical formulas that describe the
desired tuples.
Syntax:
{ t | P(t) }
let’s say we have a table called “Employees” with the following attributes:
Employee ID
To retrieve the names of all employees who
Name
earn more than $50,000 per year, we can use
the following TRC query:
Salary
In this query, the “Employees(t)” expression specifies that the tuple variable t represents a row in the
“Employees” table. The “∧” symbol is the logical AND operator, which is used to combine the condition
“t.Salary > 50000” with the table selection.
The result of this query will be a set of tuples, where each tuple contains the Name attribute of an employee
who earns more than $50,000 per year.
Domain Relational Calculus (DRC)
Domain Relational Calculus is similar to Tuple Relational Calculus, where it makes a list
of the attributes that are to be chosen from the relations as per the conditions.
{<a1,a2,a3,.....an> | P(a1,a2,a3,.....an)}
L33
L35
L98
Questions
Example 3: Find the names of all customers who have a loan and an
account at the bank.
Example 4: Find the names of all customers having a loan at the “ABC”
branch.
Solution