ANY/ALL/SOME Quantifiers and Subquery Syntax - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

When subqueries are used with quantifiers and comparison operations or IN/NOT IN predicates, the results are determined as follows.

Quantifier Predicate Result Condition
ALL Comparison operation TRUE One of the following:
  • Comparison of expression and every value in the set of values returned by subquery produces true results.
  • subquery returns no values.
IN TRUE One of the following:
  • expression is equal to every value in the set of values returned by subquery.
  • subquery returns no values.
NOT IN TRUE One of the following:
  • expression is not equal to any value in the set of values returned by subquery.
  • subquery returns no values.
  • ANY
  • SOME
Comparison operation TRUE the comparison of expression and at least one value in the set of values returned by subquery is true.
IN expression is equal to at least one value in the set of values returned by subquery.
NOT IN expression is not equal to at least one value in the set of values returned by subquery.
Comparison operation FALSE subquery returns no values.
IN
NOT IN