Professional Documents
Culture Documents
Notes Chapter 1.3 Lecture 1.3.4 (Domain Relational Calculus)
Notes Chapter 1.3 Lecture 1.3.4 (Domain Relational Calculus)
CHAPTER 1.3
Lecture-3.4 (Domain Relational Calculus)
In the tuple relational calculus, you have use variables that have a series of tuples in a
relation. In the domain relational calculus, you will also use variables, but in this case, the
variables take their values from domains of attributes rather than tuples of relations. A
domain relational calculus expression has the following general format:
where d1, d2, . . . , dn, . . . , dm stand for domain variables and F(d1, d2, . . . , dm) stands for
a formula composed of atoms.
Example:
select TCHR_ID and TCHR_NAME of teachers who work for department 8, (where suppose
- dept. 8 is Computer Application Department)
It is to be noted that these queries are safe. The use domain relational calculus is restricted to
safe expressions; moreover, it is equivalent to the tuple relational calculus, which in turn is
similar to the relational algebra.
{ < 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:
Example:
Table-1: Customer
Table-2: Loan
L10 Sub 90
L08 Main 60
Table-3: Borrower
Customername Loannumber
Ritu L01
Debomit L08
Soumya L03
Query-1: Find the loan number, branch, amount of loans of greater than or equal to 100
amount.
Resulting relation:
Loan number Branch name Amount
Query-2: Find the loan number for each loan of an amount greater or equal to 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 .
Resulting relation:
Ritu 200
Debomit 60
Soumya 150
OTHER REFRENCES