Example
A relational algebra expression might prescribe the following steps to retrieve the phone numbers and names of book stores that supply ''Some Sample Book'': # Join book stores and titles over the BookstoreID. # Restrict the result of that join to tuples for the book ''Some Sample Book''. # Project the result of that restriction over StoreName and StorePhone. A relational calculus expression would formulate this query in the following descriptive or declarative manner: :Get StoreName and StorePhone for book stores such that there exists a title BK with the same BookstoreID value and with a BookTitle value of ''Some Sample Book''.Mathematical properties
The relational algebra and the domain-independent relational calculus are logically equivalent: for any algebraic expression, there is an equivalent expression in the calculus, and vice versa. This result is known as Codd's theorem.Purpose
The raison d'ĂȘtre of the relational calculus is the formalization of query optimization. Query optimization consists in determining from a query the most efficient manner (or manners) to execute it. Query optimization can be formalized as translating a relational calculus expression delivering an answer A into efficient relational algebraic expressions delivering the same answer A.See also
* Calculus of relationsReferences
* Logical calculi Relational model {{database-stub