Girish Mahajan (Editor)

Domain relational calculus

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit

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.

Contents

In DRC, queries have the form:

{ X 1 , X 2 , . . . . , X n p ( X 1 , X 2 , . . . . , X n ) }

where each Xi is either a domain variable or constant, and p ( X 1 , X 2 , . . . . , X n ) denotes a DRC formula. The result of the query is the set of tuples X1 to Xn that make 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) in the Enterprise relation

and let (D, E, F) mean (Name, DeptName, ID) in the Department relation

Find all captains of the starship USS Enterprise:

{   A , B , C A , B , C E n t e r p r i s e     A = C a p t a i n   }

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

Find names of Enterprise crew members who are in Stellar Cartography:

{ B A , C   A , B , C E n t e r p r i s e   D , E , F   D , E , F D e p a r t m e n t s   F = C     E = S t e l l a r   C a r t o g r a p h y }

In this example, we're only looking for the name, and that's B. The condition 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:

{   B A , C   A , B , C E n t e r p r i s e     D   D , S t e l l a r   C a r t o g r a p h y , C D e p a r t m e n t s   }

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.

Systems

  • DES – An educational tool for working with Domain Relational Calculus and other formal languages
  • WinRDBI – An educational tool for working with Domain Relational Calculus and other formal languages
  • References

    Domain relational calculus Wikipedia