Relational Algebra
The relational algebra is a mathematical concept of relation of the Set theory.
About the relational algebra
The relational algebra was invented in 1970 by Edgar Frank Codd, the research director of the center IBM of San Jose. It consists of a whole of formal operations on the relations. The relational operations make it possible to create a new relation (table) starting from elementary operations on other tables (for example union, the intersection, or the difference).The principles of the relational algebra are used much nowadays by DBMS for the management of the data-processing databases like SQL, DBASE, etc
Elements of the relational model
Precise objects of the model
It is a question here of determining Fields (i.e., atomic type):- Numerical: entirety or reality (SQL: Int, Float, etc).
- Character string (SQL: Tank (20), VarChar (32), etc).
- Date (SQL: DATE, TIME, YEAR, etc).
- Standard enumerated.
Relation or Table
A relation (within the meaning of the model of Codd) consists of two things:- a Diagram: The format of the table. The diagram is fixed.
- an Extension: Contents of the table, which is a whole of tuples whose order does not have importance.
Example:
Diagram:
{Key: INT, Name: VarChar (20), Email: VarChar (20)}
Extension:
{
Requests in relational Algebra
To define an allowing whole of elementary operations, by possible combination, to obtain the anticipated results.the selection (or restriction):
-
Notation:
- Given: A relation and a formula formed of a combination of comparisons and connectors logical.
- Result: satisfies the condition given by
- Équivalent SQL: WHERE
projection :
-
Notation:
- Given: A relation and together of attributes of .
- Result: , which is the Relation where only the attributes of
- Équivalent SQL: SELECT
Operators ensemblists
The relational algebra has the usual operations on the units.Are and two relations having for whole of respective attributes and :
-
Union :
- Intersection :
- Difference :
- Produces Cartesian :
- Joint :
- Division : it takes in entry two relations and .
-
Thus, any tuple breaks up into two tuples ,
- with of diagram and
- of diagram .
- with of diagram and
-
and turns over the table of diagram such as
-
division amounts giving “all X such as for all there…”
Examples
- Relations of the base example:
Count Touristes: idTourist NomT Sport City ---------- ------- --------- --------- 1 Marc Paris Ski 2 Jean Toulouse Tennis 3 Frank Marseilles Football 4 Thomas Lyon Veils 5 max Paris Golf
Count Sports: Sport --------- Ski Cycling Tennis Football Veil Golf
Count Destinations: idTourist VilleD ---------- -------- 1 Cannes 2 Ibiza 4 Tokyo
-
Selection:
-
Projection:
-
Joint:
See too
| Random links: | Nizam Al-Mulk | Effect of reality | Ferdinand Poise | Lamar University | The Spy by love |