面试题 -- sql 查询分数不低于80 的学生

create table marklist
(
Name varchar(10),
Course varchar(10),
Mark float
)

insert into marklist(name,course,mark) values('张三','数学',75);
insert into marklist(name,course,mark) values('李四','语文',76);
insert into marklist(name,course,mark) values('李四','数学',75);
insert into marklist(name,course,mark) values('王五','英语',100);
insert into marklist(name,course,mark) values('王五','语文',81);

 

1 中: select distinct name  from marklist where name not in(select name from marklist where mark < 80)

2: select name from marklist group by name having min(mark) > 80

 

posted @ 2015-03-20 10:34  7号路灯  阅读(245)  评论(0编辑  收藏  举报