Skip to content
Related Articles

Related Articles

Improve Article

SELECT Operation in Relational Algebra

  • Last Updated : 27 May, 2020

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:

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)

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:



RollNameDepartmentFeesTeam
1BikashCSE22000A
2JoshCSE34000A
3KevinECE36000C
4BenECE56000D

Select all the student of Team A :

σ Team = 'A' (Student)

RollNameDepartmentFeesTeam
1BikashCSE22000A
2JoshCSE34000A

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

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

RollNameDepartmentFeesTeam
3KevinECE36000C
4BenECE56000D

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

σ c1c2(R)) = σ c2c1(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|
My Personal Notes arrow_drop_up
Recommended Articles
Page :