# Subquery Comparisons

**Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

Subquery comparison expressions are SQL-compliant expressions that compare a value or condition against the rows returned by a subquery. All of the expression forms in this section return boolean results.

## Considerations

- Except for `EXISTS`, each subquery must return exactly one column.
- `NULL` values in a subquery can cause a comparison to return `NULL` instead of `TRUE` or `FALSE`. To avoid unexpected results, filter out `NULL` values in your subquery (for example, `WHERE column IS NOT NULL`) when using `ALL` or `NOT IN`.

## Existence Tests

Check whether a subquery returns any rows:

- [EXISTS](/docs/data/data-cloud-query-guide/references/dc-sql-reference/exists.md) — Return true if the subquery returns at least one row.

## Membership Tests

Compare a value against the set of values returned by a subquery:

- [IN](/docs/data/data-cloud-query-guide/references/dc-sql-reference/subquery-in.md) — Return true if the value equals any subquery row.
- [NOT IN](/docs/data/data-cloud-query-guide/references/dc-sql-reference/not-in.md) — Return true if the value equals none of the subquery rows.

## Quantified Comparisons

Apply a comparison operator across the rows returned by a subquery:

- [ALL](/docs/data/data-cloud-query-guide/references/dc-sql-reference/all.md) — Return true if the comparison holds for every subquery row.
- [ANY / SOME](/docs/data/data-cloud-query-guide/references/dc-sql-reference/any-some.md) — Return true if the comparison holds for any subquery row.

## Related Documentation

- [Comparison Operators](/docs/data/data-cloud-query-guide/references/dc-sql-reference/comparison-func.md)
- [Scalar Functions](/docs/data/data-cloud-query-guide/references/dc-sql-reference/scalar-functions.md)
