Domain relational calculus
Encyclopedia
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:
where each Xi is either a domain variable or constant, and 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
.
and (D, E, F) to mean (Name, DeptName, ID)
Find all captains of the starship USS Enterprise
:
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:
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:
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.
Computer science
Computer science or computing science is the study of the theoretical foundations of information and computation and of practical techniques for their implementation and application in computer systems...
, domain relational calculus (DRC) is a calculus that was introduced by Michel Lacroix and Alain Pirotte as a declarative
Declarative programming
In computer science, declarative programming is a programming paradigm that expresses the logic of a computation without describing its control flow. Many languages applying this style attempt to minimize or eliminate side effects by describing what the program should accomplish, rather than...
database query language
Query language
Query languages are computer languages used to make queries into databases and information systems.Broadly, query languages can be classified according to whether they are database query languages or information retrieval query languages...
for the relational data model
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 F...
.
In DRC, queries have the form:
where each Xi is either a domain variable or constant, and 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
Existential quantification
In predicate logic, an existential quantification is the predication of a property or relation to at least one member of the domain. It is denoted by the logical operator symbol ∃ , which is called the existential quantifier...
(∃) and the universal quantifier
Universal quantification
In predicate logic, universal quantification formalizes the notion that something is true for everything, or every relevant thing....
(∀) can be used to bind the variables.
Its computational expressiveness is equivalent to that of Relational algebra
Relational algebra
Relational algebra, an offshoot of first-order logic , deals with a set of finitary relations that is closed under certain operators. These operators operate on one or more relations to yield a relation...
.
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
USS Enterprise (NCC-1701)
The USS Enterprise, NCC-1701, is a fictional starship in the Star Trek media franchise. The original Star Trek series depicts her crew's mission "to explore strange new worlds; to seek out new life and new civilizations; to boldly go where no man has gone before" under the command of Captain James...
:
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:
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:
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.
See also
- Relational algebraRelational algebraRelational algebra, an offshoot of first-order logic , deals with a set of finitary relations that is closed under certain operators. These operators operate on one or more relations to yield a relation...
- Relational calculusRelational calculusRelational calculus consists 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...
- Tuple relational calculusTuple relational calculusTuple calculus is a calculus that was introduced by Edgar F. Codd as part of the relational model, in order to provide a declarative database-query language for this data model...
(TRCTRCTRC is a three letter acronym that can refer to:Media and popular culture* The Red Chord, an American music group* TRC band , a London hardcore punk band* Tomb Raider Chronicles, fifth title in the Tomb Raider video game series...
)
- Tuple relational calculus
- Aldat Relational Algebra
- Domain algebra