Tupple Relational Calculus is a non-procedural query language unlike relational algebra. Tupple Calculus provides only the description of the query but it does not provide the methods to solve it. Thus, it explains what to do but not how to do.
In Tupple Calculus, a query is expressed as
In Tupple Calculus, a query is expressed as
where t = resulting tupples,
P(t) = known as Predicate and these are the conditions that are used to fetch t
P(t) = known as Predicate and these are the conditions that are used to fetch t
Thus, it generates set of all tupples t, such that Predicate P(t) is true for t.
P(t) may have various conditions logically combined with OR (∨), AND (∧), NOT(¬).
It also uses quantifiers:
∃ t ∈ r (Q(t)) = ”there exists” a tuple in t in relation r such that predicate Q(t) is true.
∀ t ∈ r (Q(t)) = Q(t) is true “for all” tuples in relation r.
It also uses quantifiers:
∃ t ∈ r (Q(t)) = ”there exists” a tuple in t in relation r such that predicate Q(t) is true.
∀ t ∈ r (Q(t)) = Q(t) is true “for all” tuples in relation r.
Example:
Relational Calculus in Dbms with forms Domain and Tuple: Contrary to relational algebra that could be a procedural source language to fetch information and that conjointly explains however it’s done, relational Calculus is a non-procedural source language and has no description regarding how the query can work or the information can be fetched. It solely focuses on what to try and do, and not on a way to have it off. Quantification - Forming Propositions from Predicates. Subjects to be Learned. Universe universal quantifier existential quantifier free variable.
Table-1: Customer
Customer name | Street | City |
---|---|---|
Saurabh | A7 | Patiala |
Mehak | B6 | Jalandhar |
Sumiti | D9 | Ludhiana |
Ria | A5 | Patiala |
Table-2: Branch
Branch name | Branch city |
---|---|
ABC | Patiala |
DEF | Ludhiana |
GHI | Jalandhar |
![Relational Relational](/uploads/1/2/5/0/125001598/716267494.jpg)
Table-3: Account
Account number | Branch name | Balance |
---|---|---|
1111 | ABC | 50000 |
1112 | DEF | 10000 |
1113 | GHI | 9000 |
1114 | ABC | 7000 |
Table-4: Loan
Loan number | Branch name | Amount |
---|---|---|
L33 | ABC | 10000 |
L35 | DEF | 15000 |
L49 | GHI | 9000 |
L98 | DEF | 65000 |
Table-5: Borrower
Customer name | Loan number |
---|---|
Saurabh | L33 |
Mehak | L49 |
Ria | L98 |
Table-6: Depositor
Customer name | Account number |
---|---|
Saurabh | 1111 |
Mehak | 1113 |
Sumiti | 1114 |
Queries-1: Find the loan number, branch, amount of loans of greater than or equal to 10000 amount.
Resulting relation:
Loan number | Branch name | Amount |
---|---|---|
L33 | ABC | 10000 |
L35 | DEF | 15000 |
L98 | DEF | 65000 |
In the above query, t[amount] is known as tupple variable.
Queries-2: Find the loan number for each loan of an amount greater or equal to 10000.
Resulting relation:
Loan number |
---|
L33 |
L35 |
L98 |
Queries-3: Find the names of all customers who have a loan and an account at the bank.
Resulting relation:
Customer name |
---|
Saurabh |
Mehak |
Queries-4: Find the names of all customers having a loan at the “ABC” branch.
Resulting relation:
Customer name |
---|
Saurabh |
Recommended Posts:
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to [email protected]. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the 'Improve Article' button below.