Relational Algebra is a procedural language that can be used to tell the DBMS how to build a new relation from one or more relations in the database and the Relational Calculus is a non-procedural language that can be used to formulate the definition of a relation in terms of one or more database relations.
While using the relational algebra, user has to specify what is required and what are the procedures or steps to obtain the required output whereas in Relational Calculus user just specifies what is required and need not to specify how to obtain it. Both the relational algebra and the relational calculus are formal, non-user-friendly languages. They have been used as the basis for other, higher-level Data Manipulation Languages (DMLs) for relational databases. They illustrate the basic operations required of any DML and serve as the standard of comparison for other relational languages.
The relational algebra is a theoretical language with operations that work on one or more relations to define another relation without changing the original relation(s). Thus, both the operands and the results are relations, and so the output from one operation can become the input to another operation. This allows expressions to be nested in the relational algebra, just as we can nest arithmetic operations. This property is called closure: relations are closed under the algebra, just as numbers are closed under arithmetic operations.
There are many variations of the operations that are included in relational algebra. Codd originally proposed eight operations, but several others have been developed. The five fundamental operations in relational algebra, Selection, Projection, Cartesian product, Union and Difference, perform most of the data retrieval operations, which can be expressed in terms of the five basic operations.
In relational algebra each operation takes one or more relations as its operand(s) and another relation as its result. Consider an example of mathematical algebra as shown below
Here, 3 and 5 are operands and + is an arithmetic operator which gives 8 as the result.
Similarly, in relational algebra, RI + R2 = R3
Here RI, R2 are relations (operands) and + is relational operator which gives R3 as a resultant relation.
Comparison Between Relational Algebra and Relational Calculus
Relational Algebra defined by using the eight basic operators, Codd then went on to define a Relational Calculus. Here, is a comparison of Relational Algebra and relational Calculus:
Related Articles (You May Also Like)