BookRags.com Literature Guides Literature
Guides
Criticism & Essays Criticism &
Essays
Questions & Answers Questions &
Answers
Lesson Plans Lesson
Plans
My Bibliography Periodic Table U.S. Presidents Shakespeare Sonnet Shake-Up
Research Anything:        
History | Encyclopedias | Films | News | Create a Bibliography | More... Login | Register | Help
Not What You Meant?  There are 12 definitions for Selection.

Selection (relational algebra)

Print-Friendly
About 1 pages (348 words)

Bookmark and Share Know this topic well? Help others and get FREE products!

In relational algebra, a selection (sometimes called a restriction to avoid confusion with SQL's use of SELECT) is a unary operation written as <math>\sigma_{a \theta b}( R )</math> or <math>\sigma_{a \theta v}( R )</math> where:

  • <math>a</math> and <math>b</math> are attribute names
  • <math>\theta</math> is a binary operation in the set <math>\{\;<, \le, =, \;>, \ge\}</math>
  • <math>v</math> is a value constant
  • <math>R</math> is a relation

The selection <math>\sigma_{a \theta b}( R )</math> selects all those tuples in <math>R</math> for which <math>\theta</math> holds between the <math>a</math> and the <math>b</math> attribute. The selection <math>\sigma_{a \theta v}( R )</math> selects all those tuples in <math>R</math> for which <math>\theta</math> holds between the <math>a</math> attribute and the value <math>v</math>. For an example, consider the following tables where the first table gives the relation <math>Person</math>, the second table gives the result of <math>\sigma_{Age \ge 34}( Person )</math> and the third table gives the result of <math>\sigma_{Age = Weight}( Person )</math>.

<math>Person</math> <math>\sigma_{Age \ge 34}( Person )</math> <math>\sigma_{Age = Weight}( Person )</math>
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:

<math>\sigma_{a \theta b}( R ) = \{\ t : t \in R,\ t(a) \ \theta \ t(b) \ \}</math>
<math>\sigma_{a \theta v}( R ) = \{\ t : t \in R,\ t(a) \ \theta \ v \ \}</math>

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. 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.

See also

View More Summaries on Selection (relational algebra)
 
Ask any question on Selection (relational algebra) and get it answered FAST!
Answer questions in BookRags Q&A and earn points toward
discounted or even FREE Study Guides and other BookRags products!
Learn more about BookRags Q&A
Copyrights
Selection (relational algebra) from Wíkipedia. ©2006 by Wíkipedia. Licensed under the GNU Free Documentation License. View a list of authors or edit this article.

Article Navigation
Join BookRagslearn moreJoin BookRags




About BookRags | Customer Service | Report an Error | Terms of Use | Privacy Policy