📜  DBMS中选择和投影的区别

📅  最后修改于: 2021-09-15 01:23:13             🧑  作者: Mango

先决条件 – 关系代数
1. 选择:
此操作从满足选择语法中提到的给定条件的关系中选择元组的子集。

符号 –

σc (R)

这里,’c’ 是选择条件,’σ (sigma)’ 用于表示Select Operator

2. 投影:
此操作选择某些必需的属性,同时丢弃其他属性。

符号 –

πA (R)

其中’A’是属性列表,它是来自relation(R)属性的期望属性集,
符号 ‘π(pi)’ 用于表示项目运算符,
R 通常是一个关系代数表达式,它导致一个关系。

DBMS中选择和投影的区别

S. No. Category Selection Projection
1. Other Names The selection operation is also known as horizontal partitioning. The Project operation is also known as vertical partitioning.
2. Use It is used to choose the subset of tuples from the relation that satisfies the given condition mentioned in the syntax of selection. It is used to select certain required attributes, while discarding other attributes.
3. Partitioning It partitions the table horizontally. It partitions the table vertically.
4. Which used first The selection operation is performed before projection (if they are to be used together). The projection operation is performed after selection (if they are to be used together).
5. Operator Used Select operator is used in Selection Operation. Project operator is used in Projection Operation.
6. Operator Symbol Select operator is denoted by Sigma symbol. Project operator is denoted by Pi symbol.
7. Commutative Selection is commutative. Projection is not commutative.
8. Column Selection Select is used to select all columns of a specific tuple. Project is used to select specific columns.
9. SQL Statements used SELECT, FROM, WHERE SELECT, FROM