You might be familiar with the ALL option in SQL Server. Perhaps you’ve used it along with the UNION operator to include any duplicates that might be returned in the result set.
But did you know that ALL can also be used in two other contexts?
ALL can be used in the following three contexts:
- As an argument to the
SELECTclause. - As an argument to the
UNIONclause. - As a logical operator when comparing a scalar value with a single-column set of values.
Examples of each of these contexts follows.