查询没有学全所有课程的学生学号和姓名
-- 表的联结
select s2.学号,s1.姓名
from chengji as s2 LEFT JOIN student as s1
on s1.学号=s2.学号
GROUP BY s2.学号
having COUNT(DISTINCT 课程号)<(select count(DISTINCT 课程号) from subject);
报错为:having COUNT(DISTINCT 课程号)<(select count(DISTINCT 课程号) from subject)
1146 - Table 'yuanshen.subject' doesn't exist
时间: 0s
表如下
Table 'yuanshen.subject' doesn't exist
这还不够明显吗
subject
subjects
sql中是subject,表名是subjects,不匹配