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:
- The main operations of the relational algebra are the set operations (such as union, intersection, and Cartesian product), selection (keeping only some lines of a table) and the projection (keeping only some columns),
- It includes a collection of methods for building new tables that constitute answers to queries.
- It is an abstract language which is not possible to execute queries formulated in relational algebra on an actual computer.
Fundamental Operations of Relational Algebra
There are two kinds of operations of relational algebra.
- Set theoretic operations
Name |
Symbol |
Keyboard Form |
Example |
UNION |
∪ |
UNION |
R∪S, or R UNION S |
INTERSECTION |
∩ |
INTERSECT |
R∩S, 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 |
R∞S, or R JOIN S |
DIVISION |
÷ |
DIVIDEBY |
R÷S, or R DIVIDEBY S |