SQL

SQL (Structured Query Language) is the declarative language for defining, querying, and manipulating relational databases. Despite decades of speculation about its replacement, SQL remains the dominant data interface across analytics, transactional systems, and increasingly across distributed and embedded databases.

Statement categories

  • DDL (Data Definition Language): CREATE, ALTER, DROP for schemas, tables, indexes
  • DML (Data Manipulation Language): SELECT, INSERT, UPDATE, DELETE
  • DCL (Data Control Language): GRANT, REVOKE for permissions
  • TCL (Transaction Control Language): BEGIN, COMMIT, ROLLBACK, SAVEPOINT

SQL dialects

The SQL standard is large; every database implements a subset and adds its own extensions. The differences matter most around: data types, window functions, recursive CTEs, JSON support, upsert syntax, and array handling.

  • PostgreSQL. The closest mainstream implementation to the standard, with rich extensions.
  • MySQL. Widely deployed; more permissive defaults; InnoDB engine.
  • SQLite. Embedded; surprising amount of SQL coverage; default for many applications.
  • SQL Server, Oracle. Enterprise heavyweights with proprietary extensions (T-SQL, PL/SQL).
  • Distributed SQL. CockroachDB, Spanner, TiDB, YugabyteDB run SQL across horizontally scaled clusters.
🔗
Related Terms
PostgreSQL, MySQL, ACID, MVCC, NoSQL, OLTP

Subscribe to Sahil's Playbook

Clear thinking on product, engineering, and building at scale. No noise. One email when there's something worth sharing.
[email protected]
Subscribe
Mastodon