1.查询出每门课都大于 80 分的学生姓名
create table test2( id int not null auto_increment, name varchar(10), kecheng varchar(10), fenshu int, primary key(id) ) insert into test2(name,kecheng,fenshu) values('张三','语文',81 ); insert into test2(name,kecheng,fenshu) values('张三','数学',75 ); insert into test2(name,kecheng,fenshu) values('李四','语文',76 ); insert into test2(name,kecheng,fenshu) values('李四','数学',90 ); insert into test2(name,kecheng,fenshu) values('王五','语文',81 ); insert into test2(name,kecheng,fenshu) values('王五','数学',100); insert into test2(name,kecheng,fenshu) values('王五','英语',90 ); -- (1) select name from test2 group by name having min(fenshu) > 80; 王五 -- (2) select distinct name from test2 where name not in (select distinct name from test2 where fenshu<=80) 王五
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。