使用course 表统计各授课单位分别开设多少门课程(课程数)。
use 学生管理
select 开课单位, ⑴ from course
group by ⑵
use 学生管理
select 开课单位, ⑴ from course
group by ⑵
举一反三
- 有三个表,学生表 Stu(Sno,Sname,Ssex,Sbirthday,Sdept),字段分别表示学号,姓名,性别,出生日期,所在系,学号为主码;课程表Course(Cno,Cname)字段分别表示课程号,课程名,课程号为主码,成绩表SC(Sno, Cno,degree),字段分别表示学号,课程号,成绩,(Sno,Cno)共同为主码,分别参考Stu,Course表的主码。查询课程号是”C01””C02””CO3”的课程名的语句是? A: SELECT Cname FROM Course WHERE Cno =”C01”&&”CO2”&&”CO3” B: SELECT Cname FROM Course WHERE Cno IN ”C01”&&”CO2”&&”CO3” C: SELECT Cname FROM Course WHERE Cno IN (”C01”, ”CO2”, ”CO3”) D: SELECT Cname FROM Course WHERE Cno IN( ”C01” AND ”CO2”AND ”CO3”)
- 【单选题】已知学生表(学号 CHAR(3),姓名 VARCHAR(8),性别 CHAR(2),出生日期 DATETIME),课程表(课程号 CHAR(3),课程名称VARCHAR(20),学分 int ),选课表(学号,课程号,成绩 int)。统计查询选课门数在2门以上的学号,课程门数,正确命令是:______。 A. SELECT 学号,count(课程号) 课程门数 from 选课 group by 学号 having count(课程号)>=2 B. SELECT 学号,count(课程号) 课程门数 from 选课 where count(课程号)>=2 group by 学号 C. SELECT 学号,count(课程号) 课程门数 from 选课 group by 学号 having count(学号)>=2 D. SELECT 学号,count(课程号) 课程门数 from 选课 where count(学号)>=2 group by 学号
- 下列语句()能够查询所有英语类课程的信息。 A: SELECT * FROM Course WHERE cname LIKE ‘%英语’ B: SELECT * FROM Course WHERE cname LIKE ‘%英语%’ C: SELECT * FROM Course WHERE cname LIKE ‘_英语_’ D: SELECT * FROM Course WHERE cname LIKE ‘*英语*’
- 设选课表的结构为:(学号、课程号、成绩),其中学号+课程号为主键。要从选课表中统计每个学生选修的课程门数,应使用的SELECT语句是______。 A: SELECT COUNT(*) FROM 选课表 B: SELECT COUNT(*) FROM 选课表 GROUP BY学号 C: SELECT DISTINCT COUNT(*) FROM 选课表 D: SELECT DISTINCT COUNT(*) FROM 选课表 GROUP BY学号
- 以下( )SQL语句可以查询出课程名中只包含“_design”字符串的课程信息。 A: select * from course where cname like '%_design%' B: select * from course where cname like '%\_design%' escape '\' C: select * from course where cname like '% D: _design%' escape ' E: ' F: select * from course where cname like '%*_design%' escape '*'