Prerequisite – Relational Algebra

**Select operation** chooses the subset of tuples from the relation that satisfies the given condition mentioned in the syntax of selection. The selection operation is also known as horizontal partitioning since it partitions the table or relation horizontally.

**Notation:**

σ_{c}(R)

where ‘c’ is selection condition which is a boolean expression(condition), we can have a single condition like Roll= 3 or combination of condition like X>2 AND Y<1,

symbol ‘σ (sigma)’ is used to denote select(choose) operator,

R is a relational algebra expression, whose result is a relation. The boolean expression specified in condition ‘c’ can be written in the following form:

<attribute name> <comparison operator> <constant value> or <attribute name>

where, <attribute name> is obviously name of an attribute of relation,

<comparison operator> is any of the operator {<, >, =, <=, >=, !=} and,

<constant value> is constant value taken from the domain of the relation.

**Example-1:**

σ_{Place = 'Mumbai' or Salary >= 1000000 }(Citizen) σ_{Department = 'Analytics'}(σ_{Location = 'NewYork'}(Manager))

The query above(immediate) is called nested expression, here, as usual, we evaluate the inner expression first (which results in relation say Manager1), then we calculate the outer expression on Manager1(the relation we obtained from evaluating the inner expression), which results in relation again, which is an instance of a relation we input.

**Example-2:**

Given a relation Student(Roll, Name, Class, Fees, Team) with the following tuples:

Roll | Name | Department | Fees | Team |
---|---|---|---|---|

1 | Bikash | CSE | 22000 | A |

2 | Josh | CSE | 34000 | A |

3 | Kevin | ECE | 36000 | C |

4 | Ben | ECE | 56000 | D |

Select all the student of Team A :

σ_{Team = 'A'}(Student)

Roll | Name | Department | Fees | Team |
---|---|---|---|---|

1 | Bikash | CSE | 22000 | A |

2 | Josh | CSE | 34000 | A |

Select all the students of department ECE whose fees is greater then equal to 10000 and belongs to Team other than A.

σ_{Fees >= 10000}(σ_{Class != 'A'}(Student))

Roll | Name | Department | Fees | Team |
---|---|---|---|---|

3 | Kevin | ECE | 36000 | C |

4 | Ben | ECE | 56000 | D |

**Important points about Select operation :**

Select operator is Unary, means it it applied to single relation only. Selection operation is commutative that is,

σ_{c1}(σ_{c2}(R)) = σ_{c2}(σ_{c1}(R))

The degree (number of attributes) of resulting relation from a Selection operation is same as the degree of the Relation given. The cardinality (number of tuples) of resulting relation from a Selection operation is,

0 <= σ_{c }(R) <= |R|

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready.

## Recommended Posts:

- RENAME (ρ) Operation in Relational Algebra
- PROJECT Operation in Relational Algebra
- Cartesian Product Operation in Relational Algebra
- Difference between Relational Algebra and Relational Calculus
- Query Optimization in Relational Algebra
- Basic Operators in Relational Algebra
- Extended Operators in Relational Algebra
- Set Theory Operations in Relational Algebra
- Introduction of Relational Algebra in DBMS
- How to solve Relational Algebra problems for GATE
- Difference between Tuple Relational Calculus (TRC) and Domain Relational Calculus (DRC)
- Relational Query Evaluation | Set 1
- Relational Query Evaluation | Set 2
- Properties of Relational Decomposition
- Relational Model in DBMS
- Anomalies in Relational Model
- Constraints on Relational database model
- Violation of constraints in relational database
- Difference between Relational database and NoSQL
- Difference between CouchDB and Relational Database

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.