LobstersSaturday · May 16, 2026FREE

SQL: Incorrect by Construction

sqldatabaseprogramming-languages

In a critical analysis published on Lobsters, the author contends that SQL is 'incorrect by construction,' pointing to fundamental design flaws that make it easy to write wrong queries. The article focuses on two main issues: implicit joins (e.g., missing ON clauses in JOINs) and the three-valued logic of NULLs. For instance, a simple query like `SELECT * FROM a, b` without a WHERE clause produces a Cartesian product, often unintended. Similarly, comparisons with NULL (e.g., `WHERE column = NULL`) always evaluate to unknown, not false, leading to missing rows. The author argues that these pitfalls are not user errors but consequences of SQL's design, which prioritizes conciseness over correctness. The piece suggests that alternative query languages or stricter SQL modes could mitigate these issues, but the core problems remain pervasive in practice.

// why it matters

Developers must be vigilant about SQL's implicit behaviors to avoid subtle data bugs.

Sources

Primary · Lobsters
▸ Read original at chreke.com

Like this? Get the next digest.

SQL: Incorrect by Construction — aigest.dev