![]() |
|
Archives of the TeradataForumMessage Posted: Fri, 11 Feb 2005 @ 21:35:07 GMT
That's not true. A subquery itself can legitimately return one or more values. [Mastering SQL by Martin Gruber] "When using subqueries in predicates based on relational operators (equations or inequalities), you must be sure to use a subquery that will produce one and only one row of output." So in following,
WHERE
exp > (subquery_max_1_row_out)
Subquery1 must return zero, 1 row or NULL. If it returns more than 1 row, then at runtime, Teradata (or any DB) gives an error msg. If we have the predicate
WHERE
exp IN (subquery_many_rows)
This subquery can return multiple rows. Besides, there are 'subquery operators' that allow the subquery to return more rows too
exp > ANY (subquery_many_rows)
exp > ALL (subquery_many_rows)
EXISTS (subquery_many_rows)
...
Kumaran Anantaraman
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| | |||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright 2016 - All Rights Reserved | |||||||||||||||||||||||||||||||||||||||||||||||||||
| Last Modified: 15 Jun 2023 | |||||||||||||||||||||||||||||||||||||||||||||||||||