Open In App

Domain Relational Calculus in DBMS

Last Updated : 15 Apr, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Domain Relational Calculus is a non-procedural query language equivalent in power to Tuple Relational Calculus. Domain Relational Calculus provides only the description of the query but it does not provide the methods to solve it. In Domain Relational Calculus, a query is expressed as,

{ < x1, x2, x3, ..., xn > | P (x1, x2, x3, ..., xn ) } 

where, < x1, x2, x3, ..., xn> represents resulting domains variables and P (x1, x2, x3, ..., xn ) represents the condition or formula equivalent to the Predicate calculus.

Predicate Calculus Formula:

  1. Set of all comparison operators
  2. Set of connectives like and, or, not
  3. Set of quantifiers

Example:

Table-1: Customer

Customer nameStreetCity
DebomitKadamtalaAlipurduar
SayantanUdaypurBalurghat
SoumyaNutanchatiBankura
RituJuhuMumbai

Table-2: Loan

Loan numberBranch nameAmount
L01Main200
L03Main150
L10Sub90
L08Main60

Table-3: Borrower

Customer nameLoan number
RituL01
DebomitL08
SoumyaL03

Query-1: Find the loan number, branch, amount of loans of greater than or equal to 100 amount.

{≺l, b, a≻ | ≺l, b, a≻ ∈ loan ∧ (a ≥ 100)}

Resulting relation:

Loan numberBranch nameAmount
L01Main200
L03Main150

Query-2: Find the loan number for each loan of an amount greater or equal to 150.

{≺l≻ | ∃ b, a (≺l, b, a≻ ∈ loan ∧ (a ≥ 150))}

Resulting relation:

Loan number
L01
L03

Query-3: Find the names of all customers having a loan at the “Main” branch and find the loan amount .

{≺c, a≻ | ∃ l (≺c, l≻ ∈ borrower ∧ ∃ b (≺l, b, a≻ ∈ loan ∧ (b = “Main”)))}

Resulting relation:

Customer NameAmount
Ritu200
Debomit60
Soumya150

Note:

The domain variables those will be in resulting relation must appear before | within ≺ and ≻ and all the domain variables must appear in which order they are in original relation or table.


Next Article
Article Tags :

Similar Reads