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. |
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. |
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. |
Filtering | This filtering variable uses a tuple of relations. | This filtering is done based on the domain of attributes. |
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 meet 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. |
Membership condition | The query cannot be expressed using a membership condition. | The query can be expressed using a membership condition. |
Query Language | The QUEL or Query Language is a query language related to it, | The QBE or Query-By-Example is a query language related to it. |
Similarity | It reflects traditional pre-relational file structures. | It is more similar to logic as a modeling language. |
Syntax | 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} | { | < EMPLOYEE > DEPT_ID = 10 } |
Focus | Focuses on selecting tuples from a relation | Focuses on selecting values from a relation |
Variables | Uses tuple variables (e.g., t) | Uses scalar variables (e.g., a1, a2, …, an) |
Expressiveness | Less expressive | More expressive |
Ease of use | Easier to use for simple queries. | More difficult to use for simple queries. |
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. |