嗨,我有以下数据库架构
Professor (EMP ID,Name,Status,Salary,Age)
Course(Course ID,Course Name,PoINts)
Works(Course ID,EMP ID,Class ID)
我已将以下查询写入返回谁教过 M1 或 M2 课程但不是两者的员工列表
SELECT p.empid,p.name
FROM professor p,course c,works w
WHERE p.empid = w.empid
AND w.courseid = c.courseid
AND ((c.coursename = ‘m1’ AND c.coursename != ‘m2’)
OR
(c.coursename = ‘m2’ AND c.coursename != ‘m1’))
上面的查询是否正确,因为我是 sql 新手,请帮忙