select * from student st inner join score sc on st.s_id=sc.s_id where sc.c_id="01"and sc.c_id !="02" -- -- -- 10、查询没有学全所有课程的同学的信息 修改符合这个语句
时间: 2023-07-16 09:12:58 浏览: 101
数据库表数据的查询操作.docx
以下是修改后的 SQL 语句:
```
SELECT *
FROM student st
WHERE NOT EXISTS (
SELECT *
FROM course
WHERE NOT EXISTS (
SELECT *
FROM score
WHERE s_id = st.s_id AND c_id = course.c_id
)
)
```
这个查询语句会返回所有学习了所有课程的同学信息。如果想查询没有学全所有课程的同学信息,只需修改 `NOT EXISTS` 为 `EXISTS` 即可:
```
SELECT *
FROM student st
WHERE EXISTS (
SELECT *
FROM course
WHERE NOT EXISTS (
SELECT *
FROM score
WHERE s_id = st.s_id AND c_id = course.c_id
)
)
```
阅读全文