HP Neoview SQL Reference Manual page 298

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

row-value-constructor
specifies the first operand of a quantified comparison predicate. The first operand can be
either of:
(expression [,expression ]...)
is a sequence of SQL value expressions, separated by commas and enclosed in parentheses.
expression cannot include an aggregate function unless expression is in a HAVING
clause. expression can be a scalar subquery (a subquery that returns a single row
consisting of a single column). See
row-subquery
is a subquery that returns a single row (consisting of a sequence of values). See
(page
ALL
specifies that the predicate is true if the comparison is true for every row selected by
table-subquery (or if table-subquery selects no rows), and specifies that the predicate
is false if the comparison is false for at least one row selected.
ANY | SOME
specifies that the predicate is true if the comparison is true for at least one row selected by
the table-subquery and specifies that the predicate is false if the comparison is false for
every row selected (or if table-subquery selects no rows).
table-subquery
provides the values for the comparison. The number of values returned by the
row-value-constructor must be equal to the number of values specified by the
table-subquery, and the data types of values returned by the row-value-constructor
must be comparable to the data types of values returned by the table-subquery. See
"Subquery" (page
Considerations for ALL, ANY, SOME
Let R be the result of the row-value-constructor, T the result of the table-subquery,
and RT a row in T.
Result of R comparison-op ALL T
If T is empty or if R comparison-op RT is true for every row RT in T, the comparison-op
ALL predicate is true.
If R comparison-op RT is false for at least one row RT in T, the comparison-op ALL predicate
is false.
Result of R comparison-op ANY T or R comparison-op SOME T
If T is empty or if R comparison-op RT is false for every row RT in T, the comparison-op
ANY predicate is false.
If R comparison-op RT is true for at least one row RT in T, the comparison-op ANY predicate
is true.
Examples of ALL, ANY, SOME
This predicate is true if the salary is greater than the salaries of all the employees who have
a jobcode of 420:
salary > ALL (SELECT salary
Consider this SELECT statement using the preceding predicate:
SELECT empnum, first_name, last_name, salary
FROM persnl.employee
WHERE salary > ALL (SELECT salary
298
SQL Language Elements
307).
307).
FROM persnl.employee
WHERE jobcode = 420)
"Expressions" (page
255).
"Subquery"

Advertisement

Table of Contents
loading

Table of Contents