Open In App

Difference between Tuple Relational Calculus (TRC) and Domain Relational Calculus (DRC)

Last Updated : 22 Mar, 2023
Like Article

1. Tuple Relational Calculus (TRC) : 
A tuple relational calculus is a non-procedural query language that specifies to select of the tuples in a relation. It can select the tuples with a range of values or tuples for certain attribute values etc. The resulting relation can have one or more tuples. 

Notation :
{T | P (T)}   or {T | Condition (T)}  

where T is the resulting tuples and P(T) is a condition used to fetch T. 

Example : 


This selects all the tuples of employee names who work for Department 10. 

2. Domain Relational Calculus (DRC) : 
A domain relational calculus uses the list of attributes to be selected from the relation based on the condition. It is the same as TRC but differs by selecting the attributes rather than selecting whole tuples.  

Notation :
{ a1, a2, a3, ..., an | P (a1, a2, a3, ..., an) } 

Where a1, a2, a3, … an are attributes of the relation and P is the condition. 

Example : 

{ |  < EMPLOYEE > DEPT_ID = 10 } 

select EMP_ID and EMP_NAME of employees who work for department 10. 

Difference between Tuple Relational Calculus (TRC) and Domain Relational Calculus (DRC) : 

S. No. Basis of Comparison Tuple Relational Calculus (TRC) Domain Relational Calculus (DRC)
1. Definition The Tuple Relational Calculus (TRC) is used to select tuples from a relation. The tuples with specific range values, tuples with certain attribute values, and so on can be selected. The Domain Relational Calculus (DRC) employs a list of attributes from which to choose based on the condition. It’s similar to TRC, but instead of selecting entire tuples, it selects attributes.
2. Representation of variables In TRC, the variables represent the tuples from specified relations. In DRC, the variables represent the value drawn from a specified domain.
3. Tuple/ Domain A tuple is a single element of relation. In database terms, it is a row. A domain is equivalent to column data type and any constraints on the value of data.
4. Filtering This filtering variable uses a tuple of relations. This filtering is done based on the domain of attributes.
5. Return Value The predicate expression condition associated with the TRC is used to test every row using a tuple variable and return those tuples that met the condition. DRC takes advantage of domain variables and, based on the condition set, returns the required attribute or column that satisfies the criteria of the condition.
5. Membership condition The query cannot be expressed using a membership condition. The query can be expressed using a membership condition.
6. Query Language The QUEL or Query Language is a query language related to it,  The QBE or Query-By-Example is query language related to it.
7. Similarity It reflects traditional pre-relational file structures.  It is more similar to logic as a modeling language.
8. Syntax Notation:  {T | P (T)} or {T | Condition (T)} Notation: { a1, a2, a3, …, an | P (a1, a2, a3, …, an)}
9. Example {T | EMPLOYEE (T) AND T.DEPT_ID = 10} { | < EMPLOYEE > DEPT_ID = 10 }
10. Focus  Focuses on selecting tuples from a relation Focuses on selecting values from a relation
11. Variables Uses tuple variables (e.g., t) Uses scalar variables (e.g., a1, a2, …, an)
12. Expressiveness Less expressive More expressive
13. Ease of use  Easier to use for simple queries. More difficult to use for simple queries.
14. Use case  Useful for selecting tuples that satisfy a certain condition or for retrieving a subset of a relation. Useful for selecting specific values or for constructing more complex queries that involve multiple relations.

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads