• sql语句的简单记录


    /*SQL查询总结:
    1.单表查询: select * from A ps:查询A表中所有数据
    2.单表带条件查询: select * from A where (查询条件) ps:查询符合 查询条件 的所有记录
    3.单表分组统计: select ClassID,Count(*) as Number from A group by ClassID ps:查询每个班级的学生人数

    多表查询:select * from A,B ps:查询表A,B的所有记录 笛卡尔积,交叉连接 结果集的记录数=A表记录数*B表记录数
    左连接(left join):select * from A a left join B b on a.ID=b.AID ps:用表A作为起始表,去与表B中的记录进行一一匹配,
    筛选出符合on条件的记录,如果表A中的记录在表B中没有找到符合on条件的匹配项,则表B中的数据自动补充为NULL。

    有连接(right join):select * from A a left join B b on a.ID=b.AID ps:用表B作为起始表,去与表A中的记录进行一一匹配,
    筛选出符合on条件的记录,如果表B中的记录在表A中没有找到符合on条件的匹配项,则表A中的数据自动补充为NULL。

    */

  • 相关阅读:
    Dice 5 ==> dice 7
    Dice 7 ==> dice 5
    100 floors 2 eggs
    Determine overlapping rectangles
    Product of integers
    Maximum profit of stocks
    样式表
    20170508
    2017年05月07
    The second day of school
  • 原文地址:https://www.cnblogs.com/feier1992/p/6432560.html
Copyright © 2020-2023  润新知