先修课程–关系代数
1.选择:
此操作从满足选择语法中提到的给定条件的关系中选择元组的子集。
表示法–
σc (R)
在这里,“ c”是选择条件,“σ(西格玛)”用来表示选择运算符。
2.投影:
此操作选择某些必需的属性,同时放弃其他属性。
表示法–
πA (R)
其中“ A”是属性列表,它是Relation(R)的属性中所需的一组属性,
符号“π(pi)”用于表示Project运算符,
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 |