姓名 科目 分数
小强 语文 80
小明 数学 60
小伟 语文 50
小闵 语文 68
小闵 数学 88
小强 数学 83
小伟 化学 96
小强 化学 76
小伟 英语 72
小强 英语 80
小明 物理 68试用一条SQL语句,选取全部科目都在80以上的学生名单。

解决方案 »

  1.   

    select distinct name from tb a where not exists(select 1 from tb where name=a.name and 分数<80)
      

  2.   

    select distinct name from table1 where name not in(select distinct name from table where 分数<80)
      

  3.   


    select distinct name from T where name not in(select name from T where 分数<80)
      

  4.   

    select distinct name from T where min(分数)>=80 group by name 
      

  5.   

    select name from tb group by name having min(分数)>=80
      

  6.   

    select name from tb group by name having min(分数)>=80
      

  7.   


    select 姓名,科目,分数 from table group by 姓名,科目,分数 having 分数 > 80
      

  8.   

    姓名 科目 分数 
    小强 语文 80 
    小明 数学 60 
    小伟 语文 50 
    小闵 语文 68 
    小闵 数学 88 
    小强 数学 83 
    小伟 化学 96 
    小强 化学 76 
    小伟 英语 72 
    小强 英语 80 
    小明 物理 68 试用一条SQL语句,选取全部科目都在80以上的学生名单。 select distinct 姓名 from tb where 姓名 not in (select 姓名 from tb where 分数 < 80)
      

  9.   

    select * from tb where 姓名 not in (select 姓名 from tb where 分数 < 80)
      

  10.   

    select name as '姓名',max(case when subject='语文' then  end),max(case when subject='数学' then  end),max(case when subject='化学' then  end),max(case when subject='物理' then  end),max(case when subject='英语' then  end)  from table2 where >=80group by name
    注:subject 科目, 分类
      

  11.   

    select distinct name from 表名 where name not in(select name from 表名 where 分数<80)