# Difference between Selection and Projection in DBMS

Prerequisite – Relational Algebra**1. Selection :**

This operation chooses the subset of tuples from the relation that satisfies the given condition mentioned in the syntax of selection.

**Notation –**

Attention reader! Don’t stop learning now. Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in **GATE Test Series Course**.

Learn all **GATE CS concepts with Free Live Classes** on our youtube channel.

σ_{c}(R)

Here, ‘c’ is selection condition and ‘σ (sigma)’ is used to denote **Select Operator**.

**2. Projection :**

This operation selects certain required attributes, while discarding other attributes.

**Notation –**

π_{A}(R)

where ‘A’ is the attribute list, it is the desired set of attributes from the attributes of relation(R),

symbol ‘π(pi)’ is used to denote the Project operator,

R is generally a relational algebra expression, which results in a relation.

**Difference between Selection and Projection in 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 |