From 7429d26dd5663b9064bc06e116bac96dd32f5990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BC=BA?= <1019253330@qq.com> Date: Fri, 20 Mar 2020 15:45:41 +0800 Subject: [PATCH] =?UTF-8?q?Update=20mysql=E7=BB=83=E4=B9=A0=E9=A2=98.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 第十三题答案不准确,做了修改 --- .../mysql\347\273\203\344\271\240\351\242\230.md" | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 =