Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update mysql练习题.md #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions 13mysql调优/mysql练习题.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down