2
select deptno
from emp2
MINUS
select deptno
from dpt
order by deptno;
上述查詢返回=無數據實測值SQL MINUS操作者
然而,
select deptno,ename
from emp2
MINUS
select deptno,dname
from dpt
order by deptno;
返回所有DEPTNO和ENAME字段值。
您能否解釋爲什麼我會在第二個查詢中使用MINUS運算符來獲取deptno字段的所有值?
legend:
emp is employee table and dpt is department table,
ename is employee name -belonging to emp,
dname is department name -belonging to dpt,
deptno is department no. -common to both
非常感謝你,現在讓我完全感覺:) –