1查询年级为的所有学生的姓名

时间:2022-07-12 13:46:13 阅读: 最新文章 文档下载
说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。
/*1查询年级为的所有学生的姓名,按学号升序排列*/ select sname from students where grade='2010' order by sid asc

/*2查询课时数是或的课程的名称*/ select cname from courses

where hour='36'or hour='72'

--3查询所有学生的学号和平均成绩,按平均成绩降序排列 select sid,avg(score) from choices group by sid

order by avg(score) desc

--4查询至少选修了三门课程的学生的学号 select sid from choices group by sid having count(*)>2

--5查询学号为“”的学生所选的某个课程的学生学号(自身连接) select second.sid

from choices as first,choices as second

where first.cid=second.cid and first.sid='201001'

--6查询学号为“”的学生同年级的所有学生资料 select* from students where grade in (select grade from students where sid='200902')

--7查询所有的有选课的学生的详细信息 select *

from choices,students,courses

where students.sid=choices.sid and choices.cid=courses.cid --8找出选修课程成绩最差的选课记录(<=all或者聚集函数) select * from choices where score<=all

--9利用集合运算,查询选修了数据库或信息系统的学生的学号 select sid


from student

10利用集合运算,查询即选修了课程又选修了课程的学生学号。


本文来源:https://www.wddqw.com/doc/3a18142dcc1755270622080a.html