MySQL Tutorial/Subquery/ALL

Материал из SQL эксперт
Перейти к: навигация, поиск

Greater than ALL

If table t2 is empty, the result is TRUE.

So, the following statement is TRUE when table t2 is empty:



SELECT * FROM t1 WHERE 1 > ALL (SELECT s1 FROM t2);


NULL subquery with "> ALL"

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);


Subqueries with ALL

Syntax:
   operand comparison_operator ALL (subquery)