zoukankan      html  css  js  c++  java
  • mySQL--找出各科最高成绩

    //找出各科最高成绩
    create table gradeMax(
    id int primary key auto_increment,
    name varchar(20),
    subject varchar(20),
    grade int
    );

    insert into gradeMax(name ,subject ,grade ) values
    ('小点','java',99),
    ('小黑','.net',100),
    ('小军','职业素养',100),
    ('小王','语文',78),
    ('小憋','数学',96),
    ('小丽','英语',87);

    select * from gradeMax
    where GRADE =(select max(grade) from gradeMax where name=name);

    select subject,max(grade),min(grade),sum(grade),avg(grade),count(grade) from gradeMax group by subject;

    主要:
    select * from gradeMax where grade in(select max(grade) from gradeMax group by subject);

    select * from gradeMax where subject,grade in gradeMax ;

  • 相关阅读:
    异常
    抽象类
    java基础—接口3
    java基础—接口2
    java基础—接口1
    Android拍照适配方案
    继承—Car
    继承—矩形
    使用CSS和jQuery实现tab页
    纯CSS实现圆形进度条
  • 原文地址:https://www.cnblogs.com/LWMLWM/p/7805916.html
Copyright © 2011-2022 走看看