A generalized selection is a unary operation written as σ φ ( R ) {\displaystyle \sigma _{\varphi }(R)} where φ {\displaystyle \varphi } is a propositional formula that consists of atoms as allowed in the normal selection and, in addition, the logical operators ∧ (and), ∨ (or) and ¬ {\displaystyle \lnot } (negation). This selection selects all those tuples in R for which φ {\displaystyle \varphi } holds.
For an example, consider the following tables where the first table gives the relation Person and the second the result of σ Age ≥ 30 ∧ Weight ≤ 60 ( Person ) {\displaystyle \sigma _{{\text{Age}}\geq 30\ \land \ {\text{Weight}}\leq 60}({\text{Person}})} .
Formally the semantics of the generalized selection is defined as follows:
The result of the selection is only defined if the attribute names that it mentions are in the header of the relation that it operates upon.
The generalized selection is expressible with other basic algebraic operations. A simulation of generalized selection using the fundamental operators is defined by the following rules:
In computer languages it is expected that any truth-valued expression be permitted as the selection condition rather than restricting it to be a simple comparison.
In SQL, selections are performed by using WHERE definitions in SELECT, UPDATE, and DELETE statements, but note that the selection condition can result in any of three truth values (true, false and unknown) instead of the usual two.
In SQL, general selections are performed by using WHERE definitions with AND, OR, or NOT operands in SELECT, UPDATE, and DELETE statements.
Codd, E.F. (June 1970). "A Relational Model of Data for Large Shared Data Banks". Communications of the ACM. 13 (6): 377–387. doi:10.1145/362384.362685. /wiki/E.F._Codd ↩