select count(*) from 表名 group by count(*)
举一反三
- select count(*) from 表名 having count(*)>;2
- 查询选修了2门课程以上的学生学号() A: select sid,count(*) from sc group by sid having count(*)>=2 B: select sid,count(*) from sc group by sid where count(*)>=2 C: select sid,count(*) from sc where count(*)>=2 group by sid D: select sid,count(*) from sc group by cid having count(*)>=2
- 按课程号分类,统计相应的选课人数() A: select cid, count(distinct sid) from sc group by cid B: select cid, count(*) from student group by cid C: select cid, count(distinct cid) from sc group by cid D: select cid, count(distinct sid) from student group by cid
- 下列查询语句中,错误的是()。 A: SELECT Sno, COUNT(*) FROM SC GROUP BY Sno B: SELECT Sno FROM SC GROUP BY Sno WHERE COUNT(*)> 3 C: SELECT Sno FROM SC GROUP BY Sno HAVING COUNT(*)> 3 D: SELECT Sno FROM SC GROUP BY Sno
- 查询最少选修了3门课程的学生学号和姓名,正确的SQL语句是()。 A: SELECT 学号,姓名,COUNT(*) FROM 选课成绩 WHERE COUNT(*)>=3 GROUP BY 学号 B: SELECT 学号,姓名,COUNT(*) FROM选课成绩 WHERE COUNT(*)>=3 GROUP BY学号,姓名 C: SELECT 学号,姓名,COUNT(*) FROM 选课成绩 GROUP BY学号HAVING COUNT(*)>=3 D: SELECT 学号,姓名,COUNT(*) FROM 选课成绩 GROUP BY学号,姓名 HAVING COUNT(*)>=3