Кіріспе
Реляциялық алгебрада таңдау (кейде Е. Ф. Коддтың 1970 жылғы жұмысына сілтеме жасап шектеу деп аталады, бірақ көпшілік пікірге қайшы, SQL-дің SELECT қолдануымен шатасудан аулақ болу үшін емес, өйткені Коддтың мақаласы SQL-дің пайда болуына дейінгі) – бұл қатынастың кіші жиынтығын білдіретін бірлік операция. Таңдау былай жазылады немесе қайда:
a және b – атрибут атаулары;
θ – жиынтықтағы екілік операция;
v – тұрақты мән;
R – қатынас.
or where:
a and b are attribute names
θ is a binary operation in the set
v is a value constant
R is a relation
The selection denotes all tuples in R for which θ holds between the a and the b attribute. The selection denotes all tuples in R for which θ holds between the a attribute and the value v.
For an example, consider the following tables where the first table gives the relation Person, 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 heading of the relation that it operates upon.
Таңдау R қатынасындағы θ операциясы a және b атрибуттары арасында орындалса, барлық туплдарды білдіреді. Таңдау R қатынасындағы θ операциясы a атрибуты мен v мәні арасында орындалса, барлық туплдарды білдіреді.
or where:
a and b are attribute names
θ is a binary operation in the set
v is a value constant
R is a relation
The selection denotes all tuples in R for which θ holds between the a and the b attribute. The selection denotes all tuples in R for which θ holds between the a attribute and the value v.
For an example, consider the following tables where the first table gives the relation Person, 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 heading of the relation that it operates upon.
Мысал ретінде, келесі кестелерді қарастырайық, онда бірінші кесте Person қатынасын, екінші кесте – нәтижесін, ал үшінші кесте – нәтижесін көрсетеді.
or where:
a and b are attribute names
θ is a binary operation in the set
v is a value constant
R is a relation
The selection denotes all tuples in R for which θ holds between the a and the b attribute. The selection denotes all tuples in R for which θ holds between the a attribute and the value v.
For an example, consider the following tables where the first table gives the relation Person, 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 heading of the relation that it operates upon.
Name
Age
Weight
Harry
34
80
Sally
28
64
George
29
70
Helena
54
54
Peter
34
80
or where:
a and b are attribute names
θ is a binary operation in the set
v is a value constant
R is a relation
The selection denotes all tuples in R for which θ holds between the a and the b attribute. The selection denotes all tuples in R for which θ holds between the a attribute and the value v.
For an example, consider the following tables where the first table gives the relation Person, 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 heading of the relation that it operates upon.
Name
Age
Weight
Harry
34
80
Helena
54
54
Peter
34
80
or where:
a and b are attribute names
θ is a binary operation in the set
v is a value constant
R is a relation
The selection denotes all tuples in R for which θ holds between the a and the b attribute. The selection denotes all tuples in R for which θ holds between the a attribute and the value v.
For an example, consider the following tables where the first table gives the relation Person, 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 heading of the relation that it operates upon.
Name
Age
Weight
Helena
54
54
or where:
a and b are attribute names
θ is a binary operation in the set
v is a value constant
R is a relation
The selection denotes all tuples in R for which θ holds between the a and the b attribute. The selection denotes all tuples in R for which θ holds between the a attribute and the value v.
For an example, consider the following tables where the first table gives the relation Person, 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 heading of the relation that it operates upon.
Формальды түрде таңдау семантикасы былай анықталады:
or where:
a and b are attribute names
θ is a binary operation in the set
v is a value constant
R is a relation
The selection denotes all tuples in R for which θ holds between the a and the b attribute. The selection denotes all tuples in R for which θ holds between the a attribute and the value v.
For an example, consider the following tables where the first table gives the relation Person, 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 heading of the relation that it operates upon.
Таңдау нәтижесі тек қана ол атап көрсеткен атрибут атаулары, ол жұмыс істейтін қатынастың тақырыбында болған жағдайда ғана анықталады.
or where:
a and b are attribute names
θ is a binary operation in the set
v is a value constant
R is a relation
The selection denotes all tuples in R for which θ holds between the a and the b attribute. The selection denotes all tuples in R for which θ holds between the a attribute and the value v.
For an example, consider the following tables where the first table gives the relation Person, 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 heading of the relation that it operates upon.
Компьютерлік тілдер
Компьютерлік тілдерде кез келген логикалық өрнекті таңдау шарты ретінде қолдануға болады, оны қарапайым салыстырумен шектеудің қажеті жоқ. SQL-де таңдаулар SELECT, UPDATE және DELETE операторларында WHERE шарттары арқылы жасалады, бірақ таңдау шарты әдеттегі екі мәннен (true, false) өзгеше, үш логикалық мән (true, false және unknown) бере алатынын ескеру керек. SQL-де кеңейтілген таңдаулар SELECT, UPDATE және DELETE операторларында AND, OR немесе NOT операторларымен бірге қолданылатын WHERE шарттары арқылы жүзеге асырылады.