3.2.8 Subquery

3.2.8.1 The Subquery as Scalar Operand

支持标量子查询

For example :

    SELECT (SELECT s2 FROM t1);  
    SELECT (SELECT s1 FROM t2) FROM t1;  
    SELECT UPPER((SELECT s1 FROM t1)) FROM t2;

3.2.8.2 Comparisons Using Subqueries

支持子查询用于比较

子查询最常用的形式是:

    non_subquery_operand comparison_operator (subquery)

其中 comparison_operator 是这些运算符之一:

    =    >    <    >=    <=    <>    !=    <=>

MySQL 也允许这种结构:

    non_subquery_operand LIKE (subquery)

3.2.8.3 Subqueries with ANY, IN, or SOME

支持此类子查询 Syntax:

    operand comparison_operator ANY (subquery)
    operand IN (subquery)
    operand comparison_operator SOME (subquery)

其中 comparison_operator 是这些运算符之一:


    =    >    <    >=    <=    <>    !=

3.2.8.4 Subqueries with ALL

支持此类子查询 Syntax:

    operand comparison_operator ALL (subquery)

3.2.8.5 Subqueries with EXISTS or NOT EXISTS

支持此类子查询

For example:

    SELECT column1 FROM t1 WHERE EXISTS (SELECT * FROM t2);

3.2.8.6 Derived Tables (Subqueries in the FROM Clause)

部分支持此类子查询

For example:

    SELECT ... FROM (subquery) [AS] tbl_name ...

不支持下面的形式:

    SELECT * FROM JSON_TABLE(arg_list) [AS] tbl_name ...
    SELECT ... FROM (subquery) [AS] tbl_name (col_list) ...

3.2.8.7 Row Subqueries

不支持行子查询

3.2.8.8 Correlated Subqueries

不支持相关子查询和相关子查询与其他子查询混合的方式

results matching ""

    No results matching ""