Jump to content

Selection (relational algebra)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Joseph Dwayne (talk | contribs) at 12:15, 30 October 2005 (rv: math notation is a user preference, unicode is not). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In relational algebra, a selection is a unary operation written as or where:

  • and are attribute names
  • is a binary operation in the set
  • is a value constant
  • is a relation

The selection selects all those tuples in for which holds between the and the attribute.

The selection selects all those tuples in for which holds between the attribute and the value .

For an example, consider the following tables where the first table gives the relation , the second table gives the result of and the third table gives the result of .

Name Age Weight
Harry 34 80
Sally 28 64
George 29 70
Helena 54 54
Peter 34 80
Name Age Weight
Harry 34 80
Helena 54 54
Peter 34 80
Name Age Weight
Helena 54 54

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 header of the relation that it operates upon.

In SQL, selections are performed by using WHERE definitions in SELECT, UPDATE, and DELETE statements.