原来一直以为C语言风格的注释“/* … */”是标准SQL注释,今天查SQL92规范,才发现标准的注释是“--”。当然,SQL92这种注释只能注释一行,有其局限性。
顺便查了一下SQL标准的各种版本。如下:
1986
SQL-86
SQL-87
First formalized by ANSI.
1989
SQL-89
FIPS 127-1
Minor revision, adopted as FIPS 127-1.
1992
SQL-92
SQL2, FIPS 127-2
Major revision (ISO 9075), Entry Level SQL-92 adopted as FIPS 127-2.
1999
SQL:1999
SQL3
Added regular expression matching, recursive queries, triggers, support for procedural and control-of-flow statements, non-scalar types, and some object-oriented features.
2003
SQL:2003
Introduced XML-related features, window functions, standardized sequences, and columns with auto-generated values (including identity-columns).
2006
SQL:2006
ISO/IEC 9075-14:2006 defines ways in which SQL can be used in conjunction 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 enables applications to integrate into their SQL code the use of XQuery, the XML Query Language published by the World Wide Web Consortium (W3C), to concurrently access ordinary SQL-data and XML documents.
2008
SQL:2008
Legalizes ORDER BY outside cursor definitions. Adds INSTEAD OF triggers. Adds the TRUNCATE statement.[21]