|
|
Search Conditions
Search conditions are used in:
WHEREandHAVINGclauses to qualify the selection of rows and groups respectivelyCHECKclauses to define sets of acceptable valuesCASEexpressions to conditionally return different valuesCASEandIFstatements to control conditional execution in a routine or triggerWHILEandREPEATstatements to control conditional iteration in a routine or trigger- the
WHENclause of a trigger to control conditional execution of the trigger action.A search condition is built from one or more predicates linked by the logical operators
ANDandORand qualified if desired by the operatorNOT.A search condition is a boolean returning expression. (See Expressions.)
Rules
Search conditions enclosed in parentheses may be used as part of more complex search condition constructions. A search condition is evaluated as follows:
- Conditions in parentheses are evaluated first.
- Within the same level of parentheses,
NOTis applied beforeAND,ANDis applied beforeOR.- Operators at the same precedence level are applied in an order determined by internal optimization routines.
The result of a search condition is evaluated by combining the results of the component predicates. Each predicate evaluates to true, false or unknown, truth tables are shown in Truth Tables.
WHEREandHAVINGclauses select the set of values for which the search condition evaluates to true.CHECKclauses define the set of values for which the search condition does not evaluate to false, i.e. is either true or unknown.Examples
Using WHERE
The
WHEREcondition determines which rows to select, for example:SELECT * FROM customer_details WHERE country_code = 'SE'Using HAVING
The
HAVINGclause restricts the selection of groups. AHAVINGclause may contain set functions in the search condition. See Mimer SQL User's Manual, Grouped Set Functions - the GROUP BY Clause.Standard Compliance
This section summarizes standard compliance concerning search conditions.
|
Mimer Information Technology AB Voice: +46 18 780 92 00 Fax: +46 18 780 92 40 info@mimer.se |
|
|