4.4.17 Search condition

Organization of this subsection
(1) Format
(2) Function
(3) Operands
(4) Syntax rules
(5) Notes
(6) Usage example

(1) Format

For the HAVING clause

search-condition::=comparison-predicate[[Figure]AND[Figure]search-condition]

For the WHERE clause

search-condition::={{'('search-condition')'|comparison-predicate}
          |NOT{[Figure]0'('search-condition')'|[Figure]comparison-predicate}
          |search-condition[Figure]OR[Figure]{'('search-condition')'|comparison-predicate}
          |search-condition[Figure]AND[Figure]{'('search-condition')'|comparison-predicate}}

(2) Function

Performs the logical operation specified in the search condition and returns only those results for which the condition is true in a relation.

A search condition is specified using the WHERE or HAVING clauses.

(3) Operands

comparison-predicate

For details about specifying a comparison predicate, see 4.4.18 Comparison predicate.

(4) Syntax rules

Specify a search condition in a WHERE or HAVING clause. The logical operations that can be specified differ depending on the clause. The following table shows the logical operations that can be specified.

Table 4-6 Logical operations that can be specified

No.Logical operationWHERE clauseHAVING clause
1ANDCan be specified.Can be specified.
2NOTCan be specified.Cannot be specified.
3ORCan be specified.Cannot be specified.

(5) Notes

(6) Usage example

Outputs data in which the value of column a in relation s1 is greater than 1 but less than 5. The underlined part indicates a search condition.

REGISTER QUERY q1 SELECT * FROM s1[ROWS 100] WHERE s1.a < 5 AND s1.a > 1;