SELECT D.dname, L.dlocation
FROM DEPARTMENT D, dept_locations L
输出:
dname dlocation
Research Houston
Research Stafford
Research Bellaire
Research Houston
Research Sugarland
Administration Houston
Administration Stafford
Administration Bellaire
Administration Houston
Administration Sugarland
Headquarters Houston
Headquarters Stafford
Headquarters Bellaire
Headquarters Houston
Headquarters Sugarland
期望的复活:
dname dlocation
Headquarters Houston
Administration Stafford
Research Bellaire
Research Houston
Research Sugarland
答案 0 :(得分:0)
您需要内部联接
SELECT D.dname, L.dlocation
FROM DEPARTMENT D inner join dept_locations L
on d.departmentid=l.departmentid