题目38:检索至少选修两门课程的学生学号

 

SELECT studentid ,COUNT(courseid) AS a
FROM student_score GROUP BY studentid HAVING a >=2

 

 

【sql 练习题  38 ,39】检索至少选修两门课程的学生学号,查询选修了全部课程的学生信息

 

 

题目39:查询选修了全部课程的学生信息

GROUP BY studentid 然后count(score)=全部课程数

 

 

SELECT student.* FROM student,
(SELECT studentid,COUNT(courseid) AS a FROM student_score GROUP BY studentid
HAVING a = (SELECT COUNT(*) FROM student_course))r WHERE student.id = r.studentid

 

 

【sql 练习题  38 ,39】检索至少选修两门课程的学生学号,查询选修了全部课程的学生信息

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-03-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-25
  • 2021-10-21
  • 2022-12-23
  • 2022-12-23
  • 2021-11-14
相关资源
相似解决方案