我正在做一些关系代数练习。在老师的幻灯片上,我看到了一件 让我觉得可能有错误的事情。我认为,第三个JOIN 应该是
JOIN 'Farmacia' as F ON 'D'.'idCF' = 'F'.'idF矛
instead of
JOIN 'Farmacia' as F ON 'F'.'idF矛 = 'D'.'idCF'
使用最后一个命令,您将自己加入Farmacia,不是吗?
The slide question says:
Which pharmacy does sell drug X of phramaceutic company Y?
语句的ON部分中的列顺序不影响 JOIN本身的完成方式。
This:
SELECT t1.columnA, t2.columnB FROM Table1 t1 JOIN Table2 t2 ON t1.ID = t2.ID
will yield the same results as this:
SELECT t1.columnA, t2.columnB FROM Table1 t1 JOIN Table2 t2 ON t2.ID = t1.ID
The self-join you described would have been something like this:
SELECT t1.columnA, t2.columnB FROM Table1 t1 JOIN Table1 t2 ON t1.managerID = t2.employeeID