The WHERE clause ( where_clause) specifies the conditions for building a results table .
<where_clause> ::= WHERE <search_condition>
The search condition is applied to each row in the temporary result table formed by the FROM clause. The result of the WHERE clause is a table that only contains those rows from the result table for which the search condition is true.
The search condition may only contain column specifications for which the user has the SELECT privilege.
Each column specification directly contained in the search condition must uniquely identify a column from the tables specified in the FROM clause of the table expression. If necessary, the column name must be qualified with the table identifier. If reference names are defined in the FROM clause for table names, they must be used as table identifiers in the search condition.
Expressions in the search condition must not contain a set function (set_function_spec), except in the exception below.
SELECT ... FROM
uppertab,...
HAVING ... (SELECT ...
WHERE
MIN(uppertab, ...)...
)
The SELECT statement is allowed in the specified format.
HAVING clause: In a subquery used in this clause, it is possible to use WHERE clauses that contain Set functions for the columns of the table used in the SELECT … HAVING statement (Correlated Subquery).
In the case of correlated subqueries, a column specification can identify a column in a table that was specified in a FROM clause of a different table expression in the QUERY specification.
Each subquery in the search condition is usually evaluated only once. In the case of a correlated subquery, the subquery is executed for each row in the result table generated by the from clause.