zoukankan      html  css  js  c++  java
  • mysql5.7innodb引擎底层分析:子查询种类回顾

    子查询种类回顾

    select * from (select m1 from t1 limit 1);  像这种只返回一个值的被称为标量子查询

    select * from (select * from t1 limit 1);  像这种只返回一行数据的子查询被称为行子查询,会有多个列返回。

    select * from (select m1 from t1 limit 10);  像这种返回一个列但是多行数据的子查询被称为列子查询

    select * from t1 where (m1, n1) = (select m2, n2 from t2);       返回多行多列的就是表子查询

    select * from t1 where m1 in ( select m2 from t2 where t1.id = t2.id );           子查询中有对外层关系的依赖,称为相关子查询

    select * from t1 where m1 in ( select m2 from t2 );      子查询中没有对外层关系的依赖,称为不相关子查询

    select * from t1 where m1 > ANY( select m2 from t2 );   等价于   select * from t1 where m1 > ( select min(m2) from t2 );

    select * from t1 where m1 > ALL( select m2 from t2 );   等价于   select * from t1 where m1 > ( select MAX(m2) from t2 );

    end.

    支付宝扫一扫,为女程序员打赏!
    作者:梦幻朵颜
    版权:本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
  • 相关阅读:
    求职简历撰写要点和模板分享
    find命令
    MD5Init-MD5Update-MD5Final
    Linux find命令详解
    Linux进程KILL不掉的原因
    Linux操作系统的内存使用方法详细解析
    Lsof命令详解
    为什么ps中CPU占用率会有超出%100的现象?
    第12课 经典问题解析一
    第11课 新型的类型转换
  • 原文地址:https://www.cnblogs.com/zhuwenjoyce/p/15027452.html
Copyright © 2011-2022 走看看