# Tuple Relational Calculus | DBMS

DBMS Tuple relational calculus: In this article, we are going to learn about the tuple relational calculus in Database management system, its query notation, examples, etc.
Submitted by Anushree Goswami, on August 09, 2019

Tuple Relational Calculus is a non-procedural and declarative query language. The declarative query procedure gives logical condition which is required to be satisfied by the results. In the non-procedural query language, the user always tries to find out the details of how to get the results. Tuple Relational Calculus explains what to do by describing query but not explain how to do by does not provide the methods to solve.

Tuple Relational Calculus in a relation is specified in the selection of tuples with details. In relation, the tuples are used by filtering variables. The result which comes out as a resultant relation can have one or more than one tuples in a resultant relation. It is easy to use by someday who is not a skilled person also. Tuple variable which integrated with a relation is called the range relation.

In Tuple Calculus, the notation of a query is:

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

Where,

• T = resulting tuples,
• P(T) = called as Predicate and It is a condition which is used to fetch T.

Example

Table 1: Engineer

RaghavA23/B6Mumbai
Sameer567/453Delhi
Sujata543/27Kanpur
ShivaniD35Jaipur
AmarB82/78Kolkata

Table 2: Company

Company City
WiproChennai
AccentureDelhi
InfosysBangalore

Table 3: Salary

Engineer Name CompanySalary
RaghavWipro24,000
SameerInfosys23,000
SujataAccenture25,000
ShivaniWipro27,000
AmarAccenture30,000

Table 4: Incentive + Bonus

CompanyIncentive + Bonus
Wipro4,000
Accenture5,000
Infosys7,000

Table 5: Salary (Included Incentive + Bonus)

Engineer Name CompanySalary
RaghavWipro28,000
SameerInfosys30,000
SujataAccenture30,000
ShivaniWipro31,000
AmarAccenture35,000

Query 1: Find the Engineer Name, Company and Salary of those whose salaries are greater than 23,000 excluded Incentive + Bonus.

`{T| T ∈ Engineer ∧ T [Salary]>= 23,000}`

The Resultant relation is:

Engineer Name Company Salary
Raghav Wipro 24,000
SujataAccenture25,000
ShivaniWipro27,000
AmarAccenture30,000

In the above query, The T [Salary] is called as Tuple variable.

Query 2: Find the Engineer Name of all the Company whose salaries are less than 27,000 excluded Incentive + Bonus.

```{T| ∃ S ∈ Engineer ( T[Company] = S[Company]
∧ S [Salary]< 27,000)}
```

The Resultant relation is:

Engineer Name
Raghav
Sameer
Sujata

Query 3: Find the Engineer Name of those who works in Accenture and their cities are Kanpur and Kolkata.

```{T| ∃ S ∈ Engineer (T [Engineer Name]) = S[Engineer Name])
∧∃ U ∈ Salary (T [Engineer Name] = U [Engineer Name])}
```

The Resultant relation is:

Engineer Name
Sujata
Amar

Query 4: Find the Engineer Name of those whose salaries included incentive + Bonus is "30,000" and their cities are Delhi and Kanpur.

```{T | ∃ S ∈ Engineer (T [City] = S[City]
∧  ∃ U ∈ Salary(Included Incentive + Bonus)(U[Salary] = "30,000"
∧ U[Engineer Name] = S[Engineer Name] ) ) }
```

The Resultant relation is:

Engineer Name
Sameer
Sujata

What's New

Top Interview Coding Problems/Challenges!

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates