Generally, the result of a relational algebra operation is a new relation.
Unary operations
Unary operations include selection and projection.
- Selection
Selection could return a new relation consisting of certain rows of the selected relation.
Predicate F is a logical expression, indicating the criteria of selection.
SelectionF = X θ Y, with
X and Y being attributes, constants, simple functions, and
θ standing for relational operators >, >=, <, <=, =, or !=.
Also, F could use logical operators AND, OR, NOT to connect sub-predicates.
- Projection
Projection could return columns satisfying predicate criteria F.
ProjectionBinary operations
- Join
Join operation selects rows from Cartesian product of two relations.
Theta join:
Join two relations under predicate F (with θ operation).
Or say,
select rows from Cartesian product with predicate F.
Equi-join:
Theta join with the θ being "=".
Two relations have same values on certain columns.
Natural join:
Special Equi-join.
Two relations have same attribute and join together after eliminate one duplicate column.
网友评论