Outer Join Relational Algebra - Teradata Database

SQL Data Manipulation Language

Product
Teradata Database
Release Number
15.10
Language
English (United States)
Last Update
2018-10-06
dita:id
B035-1146
lifecycle
previous
Product Category
Teradata® Database

The relational algebra and the relational calculus are two different, but equivalent, formal languages for manipulating relations. Algebra is procedural, for internal representations of queries that can be manipulated by query optimizers and database managers, while the calculus is nonprocedural, providing a foundation for user‑malleable query languages.

The basic query SELECT-FROM-WHERE, which is the SQL dialect of the generalized nonprocedural relational calculus for a query, can be restated in terms of relational algebra as follows.

     projection ( restriction ( product ) )

where:

 

Syntax element …

Specifies …

projection

the result of applying a PROJECT operator that extracts one or more attributes from one or more relations.

This defines an SQL SELECT … FROM. Projection selects columns from tables.

restriction

the result of applying a RESTRICT (or SELECT) operator that extracts one or more tuples from the projection.

Note that the SELECT of relational algebra is different than the SELECT statement of SQL, which essentially performs both a PROJECT operation and a RESTRICT operation.

Restriction defines the WHERE, ON, , and QUALIFY clauses of an SQL SELECT statement. Restriction selects qualified rows from tables. When a join condition exists, restriction selects qualified rows from the intermediate results table produced by the join.

product

the result of applying a PRODUCT operator that builds all possible combinations of tuples, one from each specified relation.

This defines a join, specifically, an inner join.

For clarity of presentation, restate the original expression as projection (inner join).