zoukankan      html  css  js  c++  java
  • 第三件:mysql复杂语句

    连接查询

      -- inner join

      -- left join

      -- right join

      -- full join

    子查询

      -- where子句后

        标量子查询:返回结果 一列一行

          select * from student where c_id = (select id from class where c_name = '六年级一班');

        列子查询:返回结果 一列多行

          select * from student where c_id in (select id from class);

          select * from student where c_id =any (select id from class);

          select * from student where c_id =some (select id from class);

          select * from student where c_id =all (select id from class);  -- 无结果

        行子查询:返回结果 多列多行

          构造行元素(age,height)

          select * from student where (age,height) = (select max(age),max(height) from student);

      -- from子句后

        表子查询:返回结果当做二维表来使用

          select * from (select * from student order by height desc) as a group by c_id;

      -- exists子查询

        select * from student exists(select * from class where id = 3);

      

    生活就要逢山开路遇水搭桥,愿共勉!
  • 相关阅读:
    TOJ5272: 逆矩阵
    TOJ4537: n阶行列式
    gym101532 2017 JUST Programming Contest 4.0
    Float(浮动)
    块级元素与行级元素
    MyBatis-Oracle生成主键,嵌套对象中的List增加
    MyBatis嵌套对象中的List查询
    dbcp properties
    Idea菜单字体大小调整
    DOM4J
  • 原文地址:https://www.cnblogs.com/TianMu/p/7595798.html
Copyright © 2011-2022 走看看