ALL appears in two main contexts:1. Set quantifier in SELECT – "SELECT ALL" explicitly requests that every row be returned, duplicates included. Because ALL is the default, it is rarely written, but it can make intent clear when paired with SELECT DISTINCT in the same statement or when generating dynamic SQL.2. Comparison operator modifier – Placed after a comparison operator and before a subquery, ALL requires the comparison to succeed against every value produced by the subquery. For example, x > ALL (subquery) means x is greater than the maximum value in that subquery. If the subquery returns zero rows, the comparison with ALL evaluates to TRUE. If any subquery value is NULL, the result is UNKNOWN unless eliminated with a WHERE clause.Behavior notes:- Works with =, <>, >, <, >=, <=.- The subquery must return a single column.- Comparison with ALL is semantically equivalent to comparing with MIN or MAX in many cases but keeps the query declarative.- Unlike ANY/SOME, ALL demands that the predicate hold for every subquery value.- Supported in the SQL standard and by most major databases.
DISTINCT, ANY, SOME, IN, EXISTS, MIN, MAX, subqueries
SQL-92 Standard
ALL returns every row in a SELECT or forces a comparison to be true for every value returned by a subquery.
Use it when you want to document that duplicates are intentionally kept, especially in dynamic SQL or mixed DISTINCT queries.
ANY or SOME succeeds if the predicate matches at least one subquery row. ALL requires the predicate to match every subquery row.
Yes. ALL is defined in the SQL standard and implemented by PostgreSQL, MySQL, SQL Server, Oracle, SQLite and most other relational databases.