• 3、SQL基础整理(分组)


    分组

    group by

    select class from xuesheng group by class

    select class,AVG(chinese)from xuesheng group by class

    select math from xuesheng where math >80 group by math

    select math from xuesheng where math between 80 and 90 group by math

    select math,count(*) from xuesheng where math between 80 and 90 group by math

    选出语文成绩>80的班级行总数,按班级分组

    select class,COUNT(*)from xuesheng where chinese>80 group by class

    having 后面只能加聚合函数(从表中选出where后,先看前面的聚合函数,再算后面的聚合函数)

    select class,COUNT(*)from xuesheng where chinese>=80 group by class having COUNT(*)>10

    select class,COUNT(*),AVG(math)from xuesheng group by class having AVG(math)>90

    select class,COUNT(*) from xuesheng where math>80 group by class order by COUNT(*)

    --分别求每个班语数外最高分,并按语文升序排序

    select class,MAX(chinese),MAX(math),MAX(english) from xuesheng group by class order by MAX(chinese)

  • 相关阅读:
    rmse均方根误差
    小波变换
    时频工具箱-gabor
    时频工具箱tftb
    Gabor变换
    计算非零元素
    用“人话”解释不精确线搜索中的Armijo-Goldstein准则及Wolfe-Powell准则
    步长与学习率
    chentos7 安装jdk1.8(二进制安装)
    端口转发之 nc
  • 原文地址:https://www.cnblogs.com/wleaves/p/4164981.html
Copyright © 2020-2023  润新知