**RELATIONAL CALCULUS**

- Relation status is mainly non-procedural query language. The non-procedural query language means that the user has the concern with the various details related to the obtaining of the end results.
- The relational calculus let us know about what should do you; however, it doesn’t explain about how to do.

## Kinds of Relational Calculus:

## 1. Tuple Relational Calculus (TRC)

- The Tuple Relational Calculus (TRC) is specific in selecting the tuples that are contained in any relation. The filtering variable applies the tuples of relation in a TRC.
- At the time of result, the relation can even have more or one tuples.

**Notation:**

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

Where

T is considered as the resultant tuples

P(T) is considered the condition for obtaining T.

**For instance:**

{ T.name | Author(T) AND T.article = ‘database’ }

**OUTPUT: **

This query chooses the tuples from the relation AUTHOR. It even returns a tuples with ‘name’ from author who has originally drafted an article on ‘database.’

Tuple Relation Calculus (TRC) can also be quantified. In TRC, we can easily use Universal and Existential quantifiers.

**For instance: **

{ R| ∃T ∈ Authors(T.article= ‘database’ AND R.name=T.name)}

**Output: **

The following query shall get the same result as the last one.

## 2. Domain Relational Calculus (DRC)

- Domain Relational Calculus (DRC) is also known as the second form of the relation. The domain of attributes is used for filtering variable in the Domain Relational Calculus.
- DRC uses identical operators as tuple calculus. It often uses logical connectives such as ∧ (and), ∨ (or) and ┓ (not).
- DRC uses Universal and Existential Quantifiers in order to bind the variables.

**Notation: **

{ a1, a2, a3, …, an | P (a1, a2, a3, … ,an)}

Where

a2, a1 are considered as attributes

P means the formula made by Inner attributes

**For Instance: **

{< article, page, subject > | ∈ javatpoint ∧ subject = ‘database’}

**Output: **

The respective query will give the subject, page and article from the respective relational javatpoint where the database is a subject.