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
CHECK constraints in PostgreSQL only validate the new or updated row itself; they cannot inspect other rows. This causes dump restores to fail if rows are loaded in an order that temporarily violates cross-row logic. Use UNIQUE, EXCLUDE, or FOREIGN KEY constraints for cross-row integrity, test dumps, use deferred constraints, and verify data after restore.
postgresql / check-constraint / pg_dump / pg_restore / unique-constraint / exclude-constraint / foreign-key / data-integrity
Oracle treats a zero-length character value as NULL, so you cannot distinguish an empty string from a missing value. This guide explains three-valued logic and how to write portable NULL checks.
null / oracle / empty-string / three-valued-logic / sql-portability / decode / is-null
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
Learn how NULL propagates through arithmetic and logical operations, the unique behavior of Oracle concatenation, and the nuances of three-valued logic.
sql / postgresql / oracle / sql-server / null / logic / arithmetic / database
SQL Server comparison operators return a Boolean type with TRUE, FALSE, and UNKNOWN. UNKNOWN silently excludes rows in WHERE, skips blocks in IF, and terminates loops in WHILE.
sql-server / boolean-type / three-valued-logic / null / where / if / while / ansi-nulls
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
Oracle treats empty strings as NULL, impacting SQL portability. Learn how to write portable SQL by using IS NULL.
oracle / sql / null / empty string / portability / database / sql standard
WHERE filters individual rows before grouping while HAVING filters aggregated groups after grouping. When NULL values propagate through aggregates into HAVING conditions, entire groups can be silently dropped, hiding data quality issues rather than surfacing them as exceptions.
SQL / WHERE / HAVING / NULL / three-valued-logic / aggregation / GROUP BY / ANSI_NULLS
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
SQL uses three-valued logic where NULL comparisons return UNKNOWN rather than TRUE or FALSE, causing WHERE clauses to silently drop rows. Only IS NULL and IS NOT NULL reliably test for missing values across all standard SQL engines.
sql-null / three-valued-logic / where-clause / is-null / ansi-nulls / oracle / sql-server / comparison-operators
NULL propagates through arithmetic, COUNT(*) differs from COUNT(column) by ignoring nulls, and Oracle DECODE uniquely treats two NULLs as equal while standard comparisons return UNKNOWN.
null-semantics / three-valued-logic / oracle / sql-server / decode / count / ansi-nulls / arithmetic-propagation
Understand how SET ANSI_NULLS affects SQL Server's handling of NULL in comparisons, leading to TRUE, FALSE, or UNKNOWN results.
SQL Server / ANSI_NULLS / NULL / SQL / Comparison Operators / Three-Valued Logic / UNKNOWN / IS NULL
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
Understand IS NULL, three-valued logic and the difference between COUNT(*) and COUNT(column).
SQL / PostgreSQL / NULL
A detailed technical breakdown of the differences between WHERE and HAVING clauses, focusing on execution order, aggregate function compatibility, and performance optimization strategies.
SQL / PostgreSQL / Database / Query Optimization / Data Analysis
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
A closer look at explicitly deferred NO ACTION checks and clearing only the optional component of a composite foreign key. These details complement the basic choice between RESTRICT, CASCADE and SET NULL.
postgresql / foreign-key / on-delete / data-retention / cascade / restrict / set-null / referential-integrity
LIMIT caps returned rows; OFFSET skips rows in the query result. SQL does not require ORDER BY syntactically, but repeatable page boundaries need a unique ordering. For an API, choose between page-number navigation and continuation from the last key; neither strategy alone provides a snapshot. Measure deeper pages before setting a performance cutoff.
PostgreSQL / database pagination / LIMIT / OFFSET / cursor-based pagination / query performance
Compare RESTRICT, CASCADE and SET NULL using a small isolated example, then check the actual constraint and dependent rows before changing real data.
PostgreSQL / SQL / Foreign keys / Transactions