MySQL Tutorial/Subquery/ALL
Greater than ALL
If table t2 is empty, the result is TRUE.
So, the following statement is TRUE when table t2 is empty:
<source lang="sql">
SELECT * FROM t1 WHERE 1 > ALL (SELECT s1 FROM t2);</source>
NULL subquery with "> ALL"
<source lang="sql">
SELECT * FROM t1 WHERE 1 > ALL (SELECT MAX(s1) FROM t2) is NULL when table t2 is empty: SELECT * FROM t1 WHERE 1 > ALL (SELECT MAX(s1) FROM t2);</source>
Subqueries with ALL
<source lang="sql">
Syntax:
operand comparison_operator ALL (subquery)</source>