INTERSECT returns only the rows that appear in the result sets of both component queries, comparing entire rows for equality. In this row-by-row comparison, NULL values are treated as equal to other NULLs occupying the same column position, so INTERSECT does process (evaluate) NULL values rather than ignoring them — this is one of the special cases in SQL where NULLs are considered equal for comparison purposes. This contradicts the notion that INTERSECT ignores NULLs. Additionally, a single SQL statement can contain multiple INTERSECT operators (combined with other set operators), and INTERSECT does not have lower precedence than UNION or UNION ALL — all set operators traditionally have equal precedence (evaluated left to right unless parentheses dictate otherwise), and Oracle documentation notes future releases will grant INTERSECT higher, not lower, precedence than UNION/UNION ALL.
Community Discussion