Encyclopedia of Database Systems

Living Edition
| Editors: Ling Liu, M. Tamer Özsu

Selection

Living reference work entry
DOI: https://doi.org/10.1007/978-1-4899-7993-3_1257-2

Synonyms

Definition

Given a relation instance R over set of attributes U and a condition F, the selection σ F (R) returns a new relation over U consisting of the set of tuples of R which satisfy F. The condition F is an atom of the form A = B or A = c, where A and B are attributes in U and c is a constant value.

The generalized selection allows more complex conditions: F can be an arbitrary Boolean combination of atoms of the form A = B or A ≠ B or A = c or A ≠ c. Moreover, if a total order is defined on the domain of attributes, more general comparison atoms of the form A α B or A α c are allowed, where α ranges over {=, ≠, <, >, ≤, ≥}.

Key Points

The selection is one of the basic operators of the relational algebra. It operates by “selecting” rows of the input relation. A tuple t over U satisfies the condition A = B if the values of attributes A and B in t are equal. Similarly t satisfies the condition A = c if the value of attribute A in t is c. Satisfaction of generalized selection atoms is defined analogously.

As an example, consider a relation Exams over attributes (course-number, student-number, grade), containing tuples {(EH1, 1001, A), (EH1, 1002, A), (GH5, 1001, C)}. Then σ grade=Acoursenumber = EH1(Exams) is a relation over attributes (course-number, student-number, grade) with tuples {(EH1, 1001, A), (EH1, 1002, A)}.

In the case that a relation schema is only specified by a relation name and arity, the result of the selection is a new relation having the same arity as the input one, containing the tuples which satisfy the selection condition. In this case the selection atoms are expressions of the form j = k or j = c (or j α k and j α c in the generalized selection). Here j and k are positive integers bounded by the arity of the input relation, identifying its j-th and k-th attributes, respectively.

Cross-References

Copyright information

© Springer Science+Business Media LLC 2017

Authors and Affiliations

  1. 1.IRIFParis Diderot UniversityParisFrance