scott.dept 4 筆 × scott.emp 14 筆 = 56 筆組合。
SELECT emp.empno, emp.ename, emp.deptno, dept.dname, dept.loc
FROM scott.emp, scott.dept;
依共同欄位 (如 deptno) 等值比對,過濾有效組合。
SELECT emp.empno, emp.ename, emp.deptno, dept.dname, dept.loc
FROM scott.emp, scott.dept
WHERE scott.emp.deptno = scott.dept.deptno;
要求關聯欄位具相同資料型態、寬度、取值範圍。
使用比較運算子 (!=, <, > 等) 結合條件。
SELECT emp.empno, emp.ename, emp.deptno, dept.dname, dept.loc
FROM scott.emp, scott.dept
WHERE scott.emp.deptno != scott.dept.deptno
AND scott.emp.deptno = 10;
可靈活運用 4.2.5 表中所有比較運算子組合條件。