﻿

# Domain relational calculus

In computer science, domain relational calculus (DRC) is a calculus that was introduced by Michel Lacroix and Alain Pirotte as a declarative database query language for the relational data model.

In DRC, queries have the form: $\{\langle X_1, X_2, ...., X_n \rangle \mid p(\langle X_1, X_2, ...., X_n\rangle) \}$

where each Xi is either a domain variable or constant, and $p(\langle X_1, X_2, ...., X_n \rangle)$ denotes a DRC formula. The result of the query is the set of tuples Xi to Xn which makes the DRC formula true.

This language uses the same operators as tuple calculus, the logical connectives ∧ (and), ∨ (or) and ¬ (not). The existential quantifier (∃) and the universal quantifier (∀) can be used to bind the variables.

Its computational expressiveness is equivalent to that of Relational algebra.

## Examples

Let (A, B, C) mean (Rank, Name, ID)

and (D, E, F) to mean (Name, DeptName, ID)

Find all captains of the starship USS Enterprise: $\left\{ \ {\left\langle A, B, C \right\rangle} \mid {\left\langle A, B, C \right\rangle \in \mathrm{Enterprise} \ \land \ A = \mathrm{Captain} } \ \right\}$

In this example, A, B, C denotes both the result set and a set in the table Enterprise.

Find Names of Enterprise crewmembers who are in Stellar Cartography: \begin{align} \{ {\left\langle B \right\rangle} & \mid {\exists A, C \ \left\langle A, B, C \right\rangle \in \mathrm{Enterprise} } \\ & \land \ {\exists D, E, F \ \left\langle D, E, F \right\rangle \in \mathrm{Departments} } \\ & \land \ F = C \ \land \ E = \mathrm{Stellar \ Cartography} \} \\ \end{align}

In this example, we're only looking for the name, and that's B. F = C is a requirement, because we need to find Enterprise crew members AND they are in the Stellar Cartography Department.

An alternate representation of the previous example would be: $\left\{ \ {\left\langle B \right\rangle} \mid {\exists A, C \ \left\langle A, B, C \right\rangle \in \mathrm{Enterprise} } \ \land \ {\exists D \ \left\langle D, \mathrm{Stellar \ Cartography}, C \right\rangle \in \mathrm{Departments} } \ \right\}$

In this example, the value of the requested F domain is directly placed in the formula and the C domain variable is re-used in the query for the existence of a department, since it already holds a crew member's id.

Wikimedia Foundation. 2010.

### Look at other dictionaries:

• Relational calculus — consist of two calculi, the tuple relational calculus and the domain relational calculus, that are part of the relational model for databases and provide a declarative way to specify database queries. This in contrast to the relational algebra… …   Wikipedia

• Tuple relational calculus — The tuple calculus is a calculus that was introduced by Edgar F. Codd as part of the relational model in order to give a declarative database query language for this data model. It formed the inspiration for the database query languages QUEL and… …   Wikipedia

• Calculus (disambiguation) — Calculus is Latin for pebble, and has a number of meanings in English: In mathematics and computer science Calculus , in its most general sense, is any method or system of calculation. To modern theoreticians the answer to the question what is a… …   Wikipedia

• Domain — may refer to: General Territory (administrative division), a non sovereign geographic area which has come under the authority of another government Public domain, a body of works and knowledge without proprietary interest Eminent domain, the… …   Wikipedia

• Relational algebra — Not to be confused with Relation algebra. Relational algebra, an offshoot of first order logic (and of algebra of sets), deals with a set of finitary relations (see also relation (database)) that is closed under certain operators. These operators …   Wikipedia

• Relational model — The relational model for database management is a database model based on first order predicate logic, first formulated and proposed in 1969 by Edgar Codd. [ Derivability, Redundancy, and Consistency of Relations Stored in Large Data Banks , E.F …   Wikipedia

• Relational database — A visual diagram showing the relationship between the two tables, as indicated by the arrow A relational database matches data by using common characteristics found within the data set. The resulting groups of data uses the relational model (a… …   Wikipedia

• Comparison of relational database management systems — Programming language comparisons General comparison Basic syntax Basic instructions Arrays Associative arrays String operations …   Wikipedia

• Situation calculus — The situation calculus is a logic formalism designed for representing and reasoning about dynamical domains. It was first introduced by John McCarthy in 1963. The main version of the situational calculus that is presented in this article is based …   Wikipedia

• List of mathematics articles (D) — NOTOC D D distribution D module D D Agostino s K squared test D Alembert Euler condition D Alembert operator D Alembert s formula D Alembert s paradox D Alembert s principle Dagger category Dagger compact category Dagger symmetric monoidal… …   Wikipedia