homework,select 姓名 from tab_name where 姓名 not in (select 姓名 from tab_name where 成绩 <= 80)

解决方案 »

  1.   

    select A.姓名
    from
          (select t.姓名 姓名,
           min(t.成绩)  成绩 
           from 表名 t
           group by t.姓名) A
    where A.成绩 >= 80
      

  2.   

    select DISTINCT 姓名 
    from table a 
    where 
    not exists(
    select 1 from table b where a.姓名 = b.姓名 and b.成绩 < 80
    )
      

  3.   

    select distinct 姓名 from table_name where 成绩 >80
    这样也行啊
      

  4.   

    select 姓名 from tab_name where 姓名 not in (select disticnt 姓名 from tab_name where 成绩 <= 80)
      

  5.   

    最好不要用in,
    姓名 not in (集合), 就用不了索引了,全表遍历.
      

  6.   

    select a.姓名 from tab_name a where not exists  (select * from tab_name b where b.成绩 <= 80 and a.姓名=b.姓名)