Domain Relational Calculus (DRC) in DBMS
Domain Relational Calculus (DRC) is a non-procedural query language in which queries are
expressed by describing the properties of the desired result rather than the steps to obtain it. It uses
domain variables that take values from the attributes' domains (not entire tuples like in Tuple
Relational Calculus).
General Syntax of DRC:
{ <x1, x2, ..., xn> | P(x1, x2, ..., xn) }
• <x1, x2, ..., xn> are domain variables.
• P(x1, x2, ..., xn) is a predicate formula involving conditions on the variables.
Example:
Suppose we have the following relation:
Student(RollNo, Name, Dept)
RollNo Name Dept
1 Alice CSE
2 Bob ECE
3 Charlie CSE
Query 1: Find names of all students in the CSE department.
Domain Relational Calculus Expression:
{ <N> | ∃R ∃D (Student(R, N, D) ∧ D = 'CSE') }
Explanation:
• <N> is the result: names of students.
• ∃R ∃D: There exist RollNo R and Dept D.
• Student(R, N, D) ensures that N belongs to a tuple in the relation.
• D = 'CSE' ensures that student is from the CSE department.
Comparison with Tuple Relational Calculus (TRC)
Feature Domain Relational Calculus (DRC) Tuple Relational Calculus (TRC)
Variables Range over attributes (domains) Range over tuples (rows)
Query form `{<x1, x2, ..., xn> P(x1, x2, ..., xn)}`
Use of Over attribute values Over tuples
quantifiers
Ease of Compact for specific columns Better for expressing whole tuple
expression conditions
Clarity Can be harder to read for complex More intuitive for tuple-based
queries reasoning
Tuple Relational Calculus Equivalent Example:
Query 1 in TRC:
{ s.Name | s ∈ Student ∧ s.Dept = 'CSE' }
This returns the names of all students in the CSE department.