DBMS Topics
Domain Relational Calculus DRC
Last Updated : 21 May, 2026
Domain Relational Calculus DRC is a non-procedural query language where variables range over individual attribute values domains rather than entire tuples.
Definition
Domain Relational Calculus (DRC) is a non-procedural query language where variables range over individual attribute values (domains) rather than entire tuples.
DRC is the basis for QBE (Query By Example) — a graphical query interface.
Key Difference from TRC
Worked Examples
Setup
Example 1: Simple Query
Find the names of all employees.
{ <name> | ∃id, dept, sal (
<id, name, dept, sal> ∈ EMPLOYEE
)
}
We use ∃ for the attributes we don't want in the result
but need to complete the tuple pattern.
SQL: SELECT Name FROM EMPLOYEE;
Example 2: Selection with Condition
Find names of employees earning more than 70,000.
{ <name> | ∃id, dept, sal (
<id, name, dept, sal> ∈ EMPLOYEE ∧ sal > 70000
)
}
SQL: SELECT Name FROM EMPLOYEE WHERE Salary > 70000;
Example 3: Join Query
Find employee names and their department names.
{ <ename, dname> |
∃eid, did, sal, loc (
<eid, ename, did, sal> ∈ EMPLOYEE ∧
<did, dname, loc> ∈ DEPARTMENT
)
}
Note: did appears in both atoms — this creates the join condition.
SQL:
SELECT e.Name, d.DeptName
FROM EMPLOYEE e JOIN DEPARTMENT d ON e.DeptID = d.DeptID;
Example 4: Multiple Conditions
Find employee names in CS department with salary > 70,000.
{ <ename> |
∃eid, did, sal, dname, loc (
<eid, ename, did, sal> ∈ EMPLOYEE ∧
<did, dname, loc> ∈ DEPARTMENT ∧
dname = 'Computer Science' ∧
sal > 70000
)
}
SQL:
SELECT e.Name FROM EMPLOYEE e
JOIN DEPARTMENT d ON e.DeptID = d.DeptID
WHERE d.DeptName = 'Computer Science' AND e.Salary > 70000;
Example 5: Negation
Find names of employees NOT in department 2.
{ <name> | ∃id, did, sal (
<id, name, did, sal> ∈ EMPLOYEE ∧ ¬(did = 2)
)
}
SQL: SELECT Name FROM EMPLOYEE WHERE DeptID <> 2;
Example 6: Existential — Employees who manage a project
Find names of employees who manage at least one project.
{ <ename> |
∃eid, did, sal, pid, ptitle, pbudget (
<eid, ename, did, sal> ∈ EMPLOYEE ∧
<pid, ptitle, pbudget, did> ∈ PROJECT
)
}
SQL:
SELECT DISTINCT e.Name FROM EMPLOYEE e
WHERE e.DeptID IN (SELECT DeptID FROM PROJECT);
QBE — Query By Example
DRC directly inspired QBE, a visual query interface where users fill in example values in a table grid:
| EmpID | Name | DeptID | Salary |
|---|---|---|---|
| P. | 1 | >70000 |
EMPLOYEE Table Grid
TRC vs. DRC Quick Comparison
TRC
{ t.Name | t ∈ EMPLOYEE ∧ t.Salary > 70000 }
↑ tuple variable
DRC
{ <name> | ∃id, dept, sal (<id, name, dept, sal> ∈ EMPLOYEE ∧ sal > 70000) }
↑ domain variables for each attribute
Both are equivalent in expressive power.
Both are relationally complete.
Both are the theoretical basis for SQL.
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Domain Relational Calculus DRC.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this DBMS topic.
Search Terms
dbms, database management system, database notes, sql, unit, domain, relational, calculus
Related DBMS Topics