-
查询计算机系的学生的姓名、年龄。
-
查询成绩在70~80分之间的学生的学号、课程号和成绩。
-
查询计算机系年龄在18~20之间且性别为“男”的学生的姓名、年龄。
-
查找姓王的同学的所有信息。
-
查找姓王的两个字的同学的所有信息。
-
查询“C001”号课程的最高分。
-
查询计算机系学生的最大年龄和最小年龄。
-
统计每个系的学生人数。
-
统计每门课程的选课人数和考试最高分。
-
统计每个学生的选课门数和考试总成绩,并按选课门数升序显示结果。
-
查询总成绩超过200分的学生,要求列出学号和总成绩。
-
查询选课门数超过2门的学生的学号、平均成绩和选课门数。
1.select Sname,Sage from Student where Sdept='计算机系';
2.select Sno,Cno,Grade from SC where Grade between 70 and 80;
3.select sname,sage from student where (sage between 18 and 20)
and ssex='男' and sdept='计算机系';
4.select *from student where sname like'王%';
5.select * from student where sname like '王%' and len(sname)=2;
6.select max(grade)as 最高分 from sc where cno='c001';
7.select max(sage)as 最大年龄 ,min(sage) as 最小年龄 from student
where sdept='计算机系';
8.select count(*)as 学生人数,
sdept from student group by sdept;
9.select count(*)as 选课人数,max(grade)as 最高分,
cno from sc group by cno;
10.select count(*)as 选课门数,sum(grade) as 总分,sno
from sc group by sno order by count(*) asc;
11.select sum(grade)as 总分,sno from sc
group by sno having sum(grade)>200;
12.select sno,avg(grade)as 平均成绩,count(cno)as 选课门数
from sc group by sno having count(cno)>2;