- Domain Relational Calculus uses domain variables that take on values from an attributes domain, rather than for an entire tuple.
- Formal Definition
- An expression in the domain relational calculus is of the form :
- {<x1, x2, …..., xn> | P(x1, x2, …..., xn)}
- Where
- x1, x2, …..., xn represent domain variables.
- P formula composed of atoms.
- An atom in the domain relational calculus has one of the following forms:
- <x1, x2, …..., xn> Ο΅ r, where r is a relation on n attributes and x1, x2, …..., xn are domain variables or domain constants.
- X Ξ y, where x and y are domain variables and Ξ is a comparison operator (<, ≤, >, ≥, = , ≠) Attributes x and y have domains that can be compared by Ξ
- x Ξ c, where x is a domain variable, Ξ is a comparison operator, and c is a constant in the domain of the attribute for which x and a domain variables.
Examples based on following relation.
Answer: => { < l, b, a > | < l, b, a > Ο΅ loan α΄§ a > 100000 }
Example2: Find the name of all customer who have a loan from the Mumbai branch
Answer: => { < c, a > ∃ l ((<c, l > Ο΅ borrower α΄§ ∃ b(<l, b, a > Ο΅ loan α΄§ b = "Mumbai") }