-- 查询至少有一门课与学号为"01"的同学所学相同的同学的信息
** group_concat函数将学生所学课程转化为字符串,比较字符串
select * from student where s_id in( select distinct b.s_id from score b where b.c_id in ( select c_id from score where s_id = '01'))
-- 查询和"01"号的同学学习的课程完全相同的其他同学的信息
select * from student where s_id in ( select s_id from score t1 group by s_id having group_concat(c_id) = ( select group_concat(c_id) as str2 from score where s_id = '01') and s_id != '01');
** A是B的子集,且AB元素个数相同,则AB相等
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'));
--2019/04/22 and 04/23