|
|
Line 1: |
Line 1: |
| {{Unreferenced|date=December 2009}}
| | I would [http://www.sirudang.com/siroo_Notice/2110 best psychics] like to introduce myself to you, I am Jayson Simcox but I don't like when individuals use my full title. Her family members life in Alaska [http://1.234.36.240/fxac/m001_2/7330 tarot card readings] but her spouse wants them to transfer. I am presently a journey agent. The favorite hobby for him and his kids is to play lacross and he would never give it up.<br><br>Here is my web-site :: free tarot readings; [http://www.weddingwall.com.au/groups/easy-advice-for-successful-personal-development-today/ www.weddingwall.com.au], |
| 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 [[tuple]]s 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>.
| |
| | |
| {| border=0 cellpadding=0 cellspacing=20 align=center
| |
| |- style="text-align: center"
| |
| | <math>Person</math>
| |
| | <math>\sigma_{Age \ge 34}( Person )</math>
| |
| | <math>\sigma_{Age = Weight}( Person )</math>
| |
| |- style="vertical-align: top"
| |
| |
| |
| {| border=0 cellpadding=10 cellspacing=0 style="border-collapse: collapse; border: 1px solid black"
| |
| |- style="background-color: silver; text-align: left"
| |
| ! style="border: 1px solid black" width="34%" | Name
| |
| ! style="border: 1px solid black" width="33%" | Age
| |
| ! style="border: 1px solid black" width="33%" | Weight
| |
| |-
| |
| | style="border: 1px solid black" | Harry
| |
| | style="border: 1px solid black" | 34
| |
| | style="border: 1px solid black" | 80
| |
| |-
| |
| | style="border: 1px solid black" | Sally
| |
| | style="border: 1px solid black" | 28
| |
| | style="border: 1px solid black" | 64
| |
| |-
| |
| | style="border: 1px solid black" | George
| |
| | style="border: 1px solid black" | 29
| |
| | style="border: 1px solid black" | 70
| |
| |-
| |
| | style="border: 1px solid black" | Helena
| |
| | style="border: 1px solid black" | 54
| |
| | style="border: 1px solid black" | 54
| |
| |-
| |
| | style="border: 1px solid black" | Peter
| |
| | style="border: 1px solid black" | 34
| |
| | style="border: 1px solid black" | 80
| |
| |}
| |
| |
| |
| {| border="0" cellspacing="0" cellpadding="10" style="border-collapse: collapse; border: 1px solid black"
| |
| |- style="background-color: silver; text-align: left"
| |
| ! style="border: 1px solid black" width="34%" | Name
| |
| ! style="border: 1px solid black" width="33%" | Age
| |
| ! style="border: 1px solid black" width="33%" | Weight
| |
| |-
| |
| | style="border: 1px solid black" | Harry
| |
| | style="border: 1px solid black" | 34
| |
| | style="border: 1px solid black" | 80
| |
| |-
| |
| | style="border: 1px solid black" | Helena
| |
| | style="border: 1px solid black" | 54
| |
| | style="border: 1px solid black" | 54
| |
| |-
| |
| | style="border: 1px solid black" | Peter
| |
| | style="border: 1px solid black" | 34
| |
| | style="border: 1px solid black" | 80
| |
| |}
| |
| |
| |
| {| border="0" cellpadding="10" cellspacing="0" style="border-collapse: collapse; border: 1px solid black"
| |
| |- style="background-color: silver; text-align: left"
| |
| ! style="border: 1px solid black" width="34%" | Name
| |
| ! style="border: 1px solid black" width="33%" | Age
| |
| ! style="border: 1px solid black" width="33%" | Weight
| |
| |-
| |
| | style="border: 1px solid black" | Helena
| |
| | style="border: 1px solid black" | 54
| |
| | style="border: 1px solid black" | 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-value]]d expression be permitted as the selection condition rather than restricting it to be a simple comparison.
| |
| | |
| In [[SQL]], selections are performed by using <code>[[Where (SQL)|WHERE]]</code> definitions in <code>[[Select (SQL)|SELECT]]</code>, <code>[[Update (SQL)|UPDATE]]</code>, and <code>[[Delete (SQL)|DELETE]]</code> 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==
| |
| * [[Generalized selection]]
| |
| | |
| ==References==
| |
| * http://cisnet.baruch.cuny.edu/holowczak/classes/3400/relationalalgebra/#selectionoperator
| |
| | |
| {{DEFAULTSORT:Selection (Relational Algebra)}}
| |
| [[Category:Relational algebra]]
| |
I would best psychics like to introduce myself to you, I am Jayson Simcox but I don't like when individuals use my full title. Her family members life in Alaska tarot card readings but her spouse wants them to transfer. I am presently a journey agent. The favorite hobby for him and his kids is to play lacross and he would never give it up.
Here is my web-site :: free tarot readings; www.weddingwall.com.au,