SQL 的历史


  1. 70 年代初,IBM 公司开发了 SEQUEL 语言 (Structured English Query Language,结构化英语查询语言),用于管理 RDB。
  2. 70 年代末,IBM 和甲骨文分别开始开发基于 SQL 的 RDBMS。
    PS: IBM 的产品就包括大名鼎鼎的 DB2,世界上最早的 SQL 数据库。
    PS: 甲骨文当时还叫做 Relational Software, Inc
  3. 1980 年,由于商标问题,SEQUEL 改名 SQL。
    虽然官方发音是 ess-cue-el, 但至今为止,不少人还是将其读做 /ˈsiːkwəl/
  4. 1986 年被美国国家标准学会标准化(ANSI X3.135-1986)
  5. 1987 年,ISO 采纳 ANSI SQL (ISO 9075:1987),所以这个版本也被称之为 SQL87。
  6. 后来,SQL 陆续推出 89,92,1999, 2003 .... 多个版本。
    应该是 ISO 负责制定和维护吧,也无所谓啦。


SQL-86 (or SQL-87) is the ISO 9075:1987 standard of 1987
SQL-89 is the ISO/IEC 9075:1989 standard of 1989
SQL-92 is the ISO/IEC 9075:1992 standard of 1992
SQL:1999 is the ISO/IEC 9075:1999 standard of 1999
SQL:2003 is the ISO/IEC 9075:2003 standard of 2003
SQL:2006 is the ISO/IEC 9075:2006 standard of 2006
SQL:2008 is the ISO/IEC 9075:2008 standard of 2008
SQL:2011 is the ISO/IEC 9075:2011 standard of 2011
SQL:2016 is the ISO/IEC 9075:2016 standard of 2016

Year Name Alias Comments
1986 SQL-86 SQL-87 First formalized by ANSI
1989 SQL-89 Minor revision that added integrity constraints
1992 SQL-92 SQL2 Major revision (ISO 9075)
1999 SQL:1999 SQL3
2003 SQL:2003
2006 SQL:2006
2008 SQL:2008
2011 SQL:2011
2016 SQL:2016
2019 SQL:2019

Added regular expression matching, recursive queries (e.g. transitive closure), triggers, support for procedural and control-of-flow statements, nonscalar types (arrays), and some object-oriented features (e.g. structured types), support for embedding SQL in Java (SQL/OLB) and vice versa (SQL/JRT)


Introduced XML-related features (SQL/XML), window functions, standardized sequences, and columns with autogenerated values (including identity columns)

ISO/IEC 9075-14:2006 defines ways that SQL can be used with XML. It defines ways of importing and storing XML data in an SQL database, manipulating it within the database, and publishing both XML and conventional SQL-data in XML form. In addition, it lets applications integrate queries into their SQL code with XQuery, the XML Query Language published by the World Wide Web Consortium (W3C), to concurrently access ordinary SQL-data and XML documents.

Legalizes ORDER BY outside cursor definitions. Adds INSTEAD OF triggers, TRUNCATE statement,[34] FETCH clause

Adds temporal data (PERIOD FOR)[35] (more information at: Temporal database#History). Enhancements for window functions and FETCH clause.

Adds row pattern matching, polymorphic table functions, JSON

Adds Part 15, multidimensional arrays (MDarray type and operators)

ISO 9075

最新的 SQL 标准一共分成 9 个部分(Part 5,6,7,8,12 可能是被废弃了):

  1. Part 1: Framework (SQL/Framework)
  2. Part 2: Foundation (SQL/Foundation)
  3. Part 3: Call-Level Interface (SQL/CLI)
  4. Part 4: Persistent stored modules (SQL/PSM)
    SQL 面向过程编程
  5. Part 9: Management of External Data (SQL/MED)
  6. Part 10: Object language bindings (SQL/OLB)
    Java SQLJ 相关内容
  7. Part 11: Information and definition schemas (SQL/Schemata)
  8. Part 13: SQL Routines and types using the Java TM programming language (SQL/JRT)
    又是 Java 相关
  9. Part 14: XML-Related Specifications (SQL/XML)
    XML 相关

PS: 前缀 ISO/IEC 9075-<n>:2016 – Information technology – Database languages – SQL – 省略。

PS: 还有一个拓展标准:ISO/IEC 13249 SQL Multimedia and Application Packages


多数数据库没有严格按照标准来实现,导致不通平台上的 SQL 语句是不能跨平台的。

以下是两种主要的 SQL 方言:

  • T-SQL(Transact-SQL): SQLServer
  • PL/SQL: Oracle