diff --git "a/13mysql\350\260\203\344\274\230/mysql\347\273\203\344\271\240\351\242\230.md" "b/13mysql\350\260\203\344\274\230/mysql\347\273\203\344\271\240\351\242\230.md" index 8370fc08..cd873ed7 100644 --- "a/13mysql\350\260\203\344\274\230/mysql\347\273\203\344\271\240\351\242\230.md" +++ "b/13mysql\350\260\203\344\274\230/mysql\347\273\203\344\271\240\351\242\230.md" @@ -152,10 +152,11 @@ select * from student where s_id in( select distinct a.s_id from score a where a.c_id in(select a.c_id from score a where a.s_id='01') ); -- 13、查询和"01"号的同学学习的课程完全相同的其他同学的信息 -select a.* from student a where a.s_id in( - select distinct s_id from score where s_id!='01' and c_id in(select c_id from score where s_id='01') - group by s_id - having count(1)=(select count(1) from score where s_id='01')); +SELECT * FROM student WHERE s_id IN +(SELECT s_id FROM score WHERE s_id NOT IN + (SELECT s_id FROM score WHERE c_id NOT IN (SELECT c_id FROM score WHERE s_id='01')) + GROUP BY s_id + HAVING COUNT(*)=(SELECT COUNT(*) FROM score WHERE s_id='01') AND s_id != '01'); -- 14、查询没学过"张三"老师讲授的任一门课程的学生姓名 select a.s_name from student a where a.s_id not in ( select s_id from score where c_id =