Relational Algebra–Prepared by Kamal PodderPage 1Relational Data Model: Concept of relations, Relational Algebra Operators: Selection, Projection,Union, Intersection, Set difference, Cross product, Rename, Assignment, Various types of joins,Division.IntroductionRelational algebra and relational calculus are the mathematical basis for relational databasesdeveloped by E.F. Codd.Relational algebra and relational calculus are formal query languages associated with therelational model.Informally, relational algebra is a (high-level) procedural language ( you have to state, step bystep, exactly how the result should be calculated and relational calculus a non-procedurallanguage.However, formally both are equivalent to one another.In RA and RC the duplicate elimination is always done after each operation, so that relations arealways set of tuples. In practice, real system often omit the expensive step of eliminatingduplicate tuples, leading to relations that are multisets.Relational AlgebraAlgebra isconcerned with operations on sets of numbers or symbols. Algebra is a generalizationof arithmetic. Example : Arithmetic: 3 + 4 = 3 + 4 in Algebra it would be: x + y = y + xAbasic expression of RA consists of eithera)A relation in the databaseorb)constantrelation and relational operators.General expressions are formed out of smaller sub-expressions.Both operands and results in an expression are relations, so output from one operation canbecome input to another operation. Allows expressions to be nested, just as in arithmetic.Relational Operations work on one or more relations to define another relation withoutchanging the original relations.Not used now a days as a query language in actual DBMSs. (SQL instead.)The inner, lower-level operations of a relational DBMS are relational algebra operations. Weneed to know about relational algebra to understand query execution and optimization in arelational DBMS.Why teach RA and RC ?The question might arise: Do we need to teach RA and RC in a database course? We often hear thestatement: "Students only need to learn SQL." Apparently, many database educators do not feelthat RA and RC are essential topics in their courses. Teaching SQL is a major part of a databasecourse, but coverage of RA and RC is also important. There are several reasons for this:
Relational Algebra–Prepared by Kamal PodderPage 21.RA provides the relational model with a flexible way to query a database. Knowledge of RAfacilitates learning and using SQL as a query language.2.The query processor component of the DBMS engine translates SQL code into a query plan thatincludes RA operations. Anyone who writes DBMS query processing software or needs tooptimize SQL query execution will benefit from an understanding of RA.