admin 管理员组文章数量: 1184232
2024年3月10日发(作者:中国系统架构师大会)
4 select sno, sname
from student
where sdept in (’JSJ’,’SX’,’WL’) and sage>25
group by sdept;
select sno, cno, grade/10.0+1 as level
from sc ;
select distinct sdept from student ;
select grade
from sc
where sno=’0001’and (cno=’1001’or cno=’1002’) ;
select count(*) from student where sname like ’%明% ’;
select avg(sage),max(sage) from student where sdept=’JSJ’;
select cno,sum(grade),avg(grade),max(grade),min(grade) from sc
group by cno
order by avg(grade) desc ;
select cno, avg(grade) from sc where cno in(‘1001’,’1002’)
group by cno ;
select ,avg(grade) from sc
group by
having avg(grade)>80 ;
select sno from sc group by sno having count(*)>2 ;
select cno from sc where grade>85 group by cno having count(*)=10 ;
select sno from sc group by sno having avg(grade)<60 ;
select sno from sc where grade<60 group by sno having count(*)>2 ;
select cno from student,sc where = and sdept=’JSJ’;
a:select sname from student,sc where = and cno=’1002’
b:select sname from student where sno in (select sno from sc where cno=’1002’)
select sno,grade from sc,course
where /doc/
o=/doc/ o and cname=’数据库原理’and grade <60
a:select sname from student ,sc,course
where = and /doc/
o=/doc/ o and grade>80 and cname=’数据库原
理’b:select sname from student where sno in (select sno from sc where grade>80 and cno in (select cno from course where
cname=’数据库原理’))
select sno,sname,avg(grade) from sc,student
where =
select sno from student where sno not in(select sno from sc x where grade< ( select avg(grade) from sc where
cno=/doc/ o) )
select sname from student x where sage> (
select avg(sage) from student where sdept=)
版权声明:本文标题:(完整版)sql语句练习题及答案 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/b/1710013352a553633.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论