What is the selection operation in DBMS?

A selection operator (σ)(\sigma) is a unary operator in relational algebra. We use it to select the relation's records or rows that satisfy its condition(s).

Syntax

Parameters

In the syntax above:

  • σ\sigma denotes the selection operation.

  • condtioncondtion denotes any relational conditions. Relational conditions can be anything like[=,!=,>,<,<=,>=] [= , !=, > ,<, <=,>=].

  • relationrelation denotes the table from the database onto which the selection operation is being performed.

Example

Consider a case where we have a relation PersonsPersons(Id, Name, Hometown, Age) as shown below:

Persons

Id

Name

Hometown

Age

10

Muhammad Ali

Ohio

29

11

Noah

Texas

25

12

Emma

Seattle

20

13

Arslan Ash

Lahore

22

14

Adam

Texas

18

15

Marques

California

22

16

Linus

Toronto

22

The query below will return a table having only the records where the Age is equal to 2222.

The query's output from above will be as follows:

Output

Id

Name

Hometown

Age

13

Arslan Ash

Lahore

22

15

Marques

California

22

16

Linus

Toronto

22

Multiple relational conditions

We can also have multiple relational conditions in the selection operation to get desired records. Multiple conditions join with logical operations (AND, OR). For instance:

The query above will select only those rows or records with age equal to 2222 or hometown equal to Texas. The output will be as follows:

Output

Id

Name

Hometown

Age

11

Noah

Texas

25

13

Arslan Ash

Lahore

22

14

Adam

Texas

18

15

Marques

California

22

16

Linus

Toronto

22

Conclusion

The selection operation in DBMS (Database Management System) allows us to retrieve specific records or rows from a relation based on certain conditions. Using logical operators such as AND and OR, we can combine multiple relational conditions to refine our selection and obtain the desired subset of data.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved