select r.index, sum(c.points)
from records r join exams e2 on r.index = e2.index
join courses c on c.id_course = e2.id_course
where not exists (select *
from required_courses rs
where rs.id_studie = r.id_studie
and not exists (select *
from exams e
where e.id_course = rs.id_course
and r.index = e.index
and score>5))
and score>5
group by index;
我有那個查詢。我知道它做了什麼,但不知道如何。選擇...不存在不存在查詢
我有16個表相對較大的數據庫,但只能在此查詢中使用4。
使用的表是:
- 記錄(學生)指數(PR鍵),姓名,...,id_studie(1)(關鍵)
- EXAMS [指數(學生)(PK),id_course(PK),...,得分(2),application_status]
- 課程[id_course(PK),...,分]
- REQUIRED_COURSES [id_studie(FK), id_course(fk),...]
(1)我不知道更好的窩rd英文。當某些教員有信息學,數學,物理等課程時。信息學是一個研究。 (2)得分從5到10. 10是最好的。傳球至少需要6次。
查詢: - 查找所有通過所有必修考試的學生,通過studie thay studie。打印索引和點數。
我的問題:同一個人可以解釋這是如何工作在簡單的話?
我不明白不存在&不存在的一部分。
對不起,我的英語不好。
我認爲這篇文章由喬Celko可能會幫助你:[分開我們的立場:關係部門的SQL](https://www.simple-talk.com/sql/t-sql-programming/divided-we- stand-the-sql-of-relational-division /) – jpw 2014-09-01 14:51:45
這是**真正的**幫助。非常感謝你。 我不知道這叫做師。 – Nemanja 2014-09-01 15:39:52