In relational algebra, a selection (sometimes called a restriction in reference to E.F. Codd's 1970 paper and not, contrary to a popular belief, to avoid confusion with SQL's use of SELECT, since Codd's article predates the existence of SQL) is a unary operation that denotes a subset of a relation.
A selection is written as σ a θ b ( R ) {\displaystyle \sigma _{a\theta b}(R)} or σ a θ v ( R ) {\displaystyle \sigma _{a\theta v}(R)} where:
The selection σ a θ b ( R ) {\displaystyle \sigma _{a\theta b}(R)} denotes all tuples in R for which θ holds between the a and the b attribute.
The selection σ a θ v ( R ) {\displaystyle \sigma _{a\theta v}(R)} denotes all tuples in R for which θ holds between the a attribute and the value v.
For an example, consider the following tables where the first table gives the relation Person, the second table gives the result of σ Age ≥ 34 ( Person ) {\displaystyle \sigma _{{\text{Age}}\geq 34}({\text{Person}})} and the third table gives the result of σ Age = Weight ( Person ) {\displaystyle \sigma _{{\text{Age}}={\text{Weight}}}({\text{Person}})} .
More formally the semantics of the selection is defined as follows:
The result of the selection is only defined if the attribute names that it mentions are in the heading of the relation that it operates upon.