Relational Algebra

作者: jin2017 | 来源:发表于2017-12-18 13:43 被阅读1次

    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.

    Selection

    F = 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.

    Projection
    Binary 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.

    相关文章

      网友评论

        本文标题:Relational Algebra

        本文链接:https://www.haomeiwen.com/subject/ggupwxtx.html