0% found this document useful (0 votes)
27 views2 pages

DRC

Domain Relational Calculus (DRC) is a non-procedural query language that focuses on the properties of the desired results using domain variables. It allows for expressing queries in a compact form, particularly for specific columns, compared to Tuple Relational Calculus (TRC) which operates over entire tuples. An example query demonstrates how to find names of students in the CSE department using DRC syntax.

Uploaded by

abhishekresid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views2 pages

DRC

Domain Relational Calculus (DRC) is a non-procedural query language that focuses on the properties of the desired results using domain variables. It allows for expressing queries in a compact form, particularly for specific columns, compared to Tuple Relational Calculus (TRC) which operates over entire tuples. An example query demonstrates how to find names of students in the CSE department using DRC syntax.

Uploaded by

abhishekresid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

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.

You might also like