Comparing a Subquery Value by Using a Comparison Operator
You can use a subquery as a filter in a WHERE clause or HAVING clause by using one of the comparison operators (=, <>, <, <=, >, or >=). The important characteristics of a subquery comparison test are:
The comparison operators work the same way as they do in other comparisons (refer to Table 4.2 in Chapter 4).
The subquery can be simple or correlated (see “Simple and Correlated Subqueries” earlier in this chapter).
The subquery’s SELECT-clause list can include only one expression or column name.
The compared values must have the same data type or must be implicitly convertible to the same type (see “Converting Data Types with CAST()” in Chapter 5).
String comparisons may be case-insensitive ...
Get SQL: Visual QuickStart Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.