Three-valued logic produces UNKNOWN when a nullable operand enters a comparison, and that single value diverges in effect across filtering, conditional, and loop constructs. Wrapping the operand with COALESCE and a domain-safe sentinel collapses the logic to two values, making every context behave identically.
three-valued-logic / NULL-handling / COALESCE / sentinel-pattern / T-SQL / Oracle / control-flow / outer-joins
PostgreSQL's NULLS NOT DISTINCT makes unique constraints treat NULLs as equal, rejecting duplicate NULLs; default treats them as distinct. Portability varies.
PostgreSQL / unique constraint / NULLS NOT DISTINCT / SQL standard / portability
Oracle treats empty strings as NULL but concatenates them as empty. This exception aids string building but harms portability and safety in checks. This article explains how NULL propagates through most Oracle operators, why concatenation is the sole exception, how SQL Server differs under SET ANSI_NULLS, and why explicit IS NULL and COALESCE handling is safer for cross-database designs.
Oracle / SQL / NULL / Concatenation / Portability / Best Practices
In SQL's three-valued logic, NOT UNKNOWN remains UNKNOWN. This causes WHERE clauses to silently exclude rows with NULL values when using negated comparisons, leading to incomplete result sets.
sql / postgresql / nulls / three-valued logic / database / querying / sql-logic / data-integrity
Oracle treats zero-length character values as NULL, breaking portability and comparison logic; always use IS NULL explicitly.
Oracle / NULL / empty string / portability / SQL
Standard comparisons return UNKNOWN for NULL operands, yet Oracle's DECODE and its compound-key rules treat two NULLs as matching. This article explains the split and where it stops applying.
sql / oracle / null-semantics / three-valued-logic / decode / composite-keys / sql-server / portability
In outer joins, a condition in ON is evaluated during the join while a condition in WHERE filters the already-built result, so moving a filter between them can change which rows survive. For inner joins the placement is purely stylistic.
postgresql / sql / outer-join / left-join / join-conditions
Table aliases rename a table reference for the rest of the query, which makes self-joins possible but forbids using the original table name afterward. Derived tables such as subqueries and VALUES lists follow the same naming rules.
postgresql / sql / aliases / derived-tables / joins
PostgreSQL CHECK constraints may only reference the row being inserted or updated. A CHECK that compares against other rows can pass simple tests yet fail during pg_dump restore, because rows load in an order that may not satisfy it.
postgresql / constraints / check-constraint / data-integrity / dump-restore / ddl
Port NULL handling across Oracle, SQL Server, MySQL and SQLite by fixing four portability points: how a NULL is tested, what a comparison against NULL returns, whether boolean contexts coerce NULL, and what an empty string means. Oracle treats a zero-length character as null but warns this may change, while SQL Server depends on ANSI_NULLS, MySQL returns NULL for comparisons and coerces 0 and NULL to false in boolean contexts, and SQLite's IS and IS NOT are an extension.
SQL portability / NULL handling / Oracle / SQL Server / MySQL / SQLite / empty string / ANSI_NULLS