**1. Tuple Relational Calculus (TRC) :**

A tuple relational calculus is a non procedural query language which specifies to select the tuples in a relation. It can select the tuples with 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 resulting tuples and P(T) is a condition used to fetch T.

**Example :**

{T | EMPLOYEE (T) AND T.DEPT_ID = 10}

This select all the tuples of employee name who work for Department 10.

**2. Domain Relational Calculus (DRC) :**

A domain relational calculus uses list of attribute to be selected from the relation based on the condition. It is 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) :**

Tuple Relational Calculus (TRC) | Domain Relational Calculus (DRC) |
---|---|

In TRS, the variables represent the tuples from specified relation. | In DRS, the variables represent the value drawn from specified domain. |

A tuple is a single element of relation.In database term, it is a row. | A domain is equivalent to column data type and any constraints on value of data. |

In this filtering variable uses tuple of relation. | In this filtering is done based on the domain of attributes. |

Notation : {T | P (T)} or {T | Condition (T)} |
Notation : { a1, a2, a3, …, an | P (a1, a2, a3, …, an)} |

Example : {T | EMPLOYEE (T) AND T.DEPT_ID = 10} |
Example : { | < EMPLOYEE > DEPT_ID = 10 } |

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the **CS Theory Course** at a student-friendly price and become industry ready.