Relational Algebra


Relational algebra was introduced by E. F. Codd in 1970s. The aim was to demonstrate the potential for a query language to retrieve information from a relational database system.

Algebra
It is any formal mathematical system consisting of a set of objects and operations on those objects. Simply put, algebra is about finding the unknown or putting real life variables into equations and then solving them.

Relational Algebra
It is a family of algebra with a well-founded semantics used for modelling the data stored in relational databases, and defining queries on it: Fundamental Operations of Relational Algebra
There are two kinds of operations of relational algebra.
Set theoretic operations

Name Symbol Keyboard Form Example
UNION UNION RS, or R UNION S
INTERSECTION INTERSECT RS, or R INTERSECT S
DIFFERENCE — or MINUS R—S, or R MINUS S
PRODUCT × TIMES R×S, or R TIMES S

Native relational operations

Name Symbol Keyboard Form Example
PROJECT R[ ] R[ ] R[ Ai1 ... Aik ]
SELECT R where C R where C R where A1 = 5
JOIN JOIN RS, or R JOIN S
DIVISION ÷ DIVIDEBY R÷S, or R DIVIDEBY S