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
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, 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
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
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
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
Select one whole event per account with an explicit tie-breaker and a deliberate policy for missing timestamps.
data
Use ON CONFLICT to atomically insert or update rows based on unique constraints. Specify the exact conflict target, handle duplicate input rows, and understand that excluded values replace, not accumulate.
postgresql / sql / upsert / insert / on-conflict / unique-constraint / concurrency / database
Transactions in PostgreSQL allow grouping SQL operations into atomic blocks using the commands BEGIN, COMMIT, and ROLLBACK. This ensures data integrity: either all changes are applied or none at all. The mechanism is based on ACID principles - atomicity, consistency, isolation, and durability.
PostgreSQL / transactions / BEGIN / COMMIT / ROLLBACK / ACID / savepoint
Find the expensive step and distinguish estimates from measurements.
PostgreSQL / SQL / Performance
Diagnose repeated JOIN rows by counting matching keys, checking constraints and choosing whether the result should contain orders, items or summaries.
SQL / JOIN / PostgreSQL