SET Operations with NULLs
SET Operations with NULLs is a SQL statement in the Set Operations category. Set operations treat NULLs as equal when comparing rows. Two rows with NULL in the same column are considered duplicates. The syntax is UNION / INTERSECT / EXCEPT treat NULLs as equal for dedup purposes.. It returns nULL-aware set result. A close relative is UNION, which combines results from two queries, removing duplicate rows. Each SELECT must have the same number of columns. A close relative is UNION ALL, which like UNION but does NOT remove duplicate rows. Faster because no dedup is needed. A close relative is INTERSECT, which returns rows that appear in BOTH query results. Supported in PostgreSQL, SQL Server, Oracle. More about this category: Set-based operations — UNION, UNION ALL, INTERSECT, EXCEPT. Related Set Operations entries: UNION, UNION ALL, INTERSECT, EXCEPT / MINUS, INTERSECT ALL / EXCEPT ALL, Ordering Set Operations, TABLE Keyword, Set Operation Precedence.