Relational Algebra

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.

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容