SQL Standards
SQL Standards
Definition
SQL is standardized by ISO/IEC and ANSI, not owned by any one database vendor. The standard defines a common core of syntax and behavior so that a SQL skill (and, to a large extent, SQL code) is portable across products. The standard has evolved through named revisions: SQL-86 (the first standard), SQL-92 (a major expansion — joins, subqueries), SQL:1999 (recursive queries, triggers), SQL:2003 (window functions, MERGE), SQL:2011 (temporal data), SQL:2016 (JSON support), and later revisions adding more.
How It Works
No database vendor implements 100% of the standard, and every vendor adds proprietary extensions beyond it. The standard acts as a shared baseline: a plain SELECT ... FROM ... WHERE ... ORDER BY statement written to the standard will run almost unchanged on MySQL, PostgreSQL, SQL Server, and Oracle. The moment you use a vendor-specific feature — auto-increment syntax, a proprietary function name, a non-standard LIMIT clause — portability breaks.
Example: SELECT TOP 10 * FROM students is Microsoft SQL Server's proprietary way to limit rows; the ISO-standard-influenced equivalent most other engines accept is SELECT * FROM students LIMIT 10, and true standard SQL uses FETCH FIRST 10 ROWS ONLY.
Edge Cases and Pitfalls
- Assuming that "valid SQL" automatically means "standard SQL" — much day-to-day SQL people write is actually a vendor dialect.
- Relying on a recent standard feature (e.g. window functions from SQL:2003) without checking whether the target engine's version actually implements it — older engine versions may not.
- Standards evolve; a query written for very old SQL-92-only compliance may miss much more expressive, more efficient features available in modern standard SQL.
Key Takeaways
- The SQL standard is maintained by ISO/IEC, giving a common syntax baseline across vendors.
- Standard compliance is partial everywhere — every real database mixes standard SQL with proprietary extensions.
- Writing to the standard where possible maximizes portability; using vendor extensions trades portability for vendor-specific power or convenience.