Comparison Operators
You can use any standard SQL operators in a
- The data types of the data used in the comparison must match. That is, only text can be compared to text, numbers to numbers, and so on. For information about converting data types, see Data Type Conversion.
- If you compare text data, the result depends on the character set currently in use. For example, if a table was created using Scandinavian characters, the search results might differ depending on whether your current character set (
code page ) is Scandinavian or another character set. - If a comparison value is null, the result is unknown. Nulls are not matched to any value, including other instances of null. For example, if you are searching for a name beginning with the letter "M" or higher (
name >= 'M'
), and some of the rows contain no value, those rows do not appear, no matter what comparison operator you use.
The following table summarizes search condition operators that are defined for standard SQL and how the operators are entered in the Grid Pane. For more information, see Operators.
Operator | Meaning | Grid pane example1 | SQL pane example |
---|---|---|---|
= | Equal. |
|
|
<> != |
Not equal to. |
|
|
> | Greater than. |
|
|
< | Less than. |
|
|
>= !< |
Greater than or equal to. |
|
|
<= !> |
Less than or equal to. |
|
|
BETWEEN expr1 AND expr2 |
Tests range of values. |
|
|
IS [NOT] NULL | Tests whether contents of column or result of |
|
|
[NOT] LIKE | Performs pattern matching (usually restricted to character data types). |
|
|
expr1 [NOT] IN (val1, val2, ...) – or – expr1 [NOT] IN (subquery) |
Matches list of specific values by testing whether expr1 appears either in a list of values or in the |
|
|
ANY (SOME) | Tests whether one or more rows in the result set of a subquery meet the specified condition. (ANY and SOME are synonyms; the Query Designer will use ANY when creating an SQL statement.) |
|
|
ALL | Tests whether all rows in the result set of a subquery meet the specified condition. |
|
|
[NOT] EXISTS | Tests whether a subquery returns any results whatsoever (not a specific result). |
|
|
1 For clarity, the Grid pane examples include only one example for each operator and do not indicate which data column is being searched.
2 Dates can be entered in the Grid pane using the format specified in the Windows Regional Settings dialog box. For details, see Entering Search Values.