SQL
维库,知识与思想的自由文库
SQL 全称是结构化查询语言 (Structured Query Language),是用于数据库中的标准數據查询語言,IBM 公司最早使用在其开发的數據库系统中。1986年10月,美国 ANSI 对 SQL 进行规范后以此作为关系式數據库管理系统的标准語言 (ANSI X3. 135-1986),1987年得到國際標準組織的支持下成为国际标准。不过各种通行的數據库系统在其实践过程中都对 SQL 规范作了某些编改和扩充。所以在实际上,不同數據库系统之间的 SQL 語言不能完全相互通用。
目录 |
[编辑] 歷史
SQL 是高级的非過程化編程語言,它允许用户在高层數據结构上工作。它不要求用户指定对數據的存放方法,也不需要用户了解其具体的數據存放方式。而它的界面能使具有底层结构完全不同的數據库系统和不同數據库之间使用相同的 SQL 語言作为數據的输入与管理。它以记录项目〔records〕的合集(set)〔项集,record set〕作为操纵对象,所有 SQL 语句接受项集作为输入,回送出的项集作为输出,这种项集特性允许一条 SQL 语句的输出作为另一条 SQL 语句的输入,所以 SQL 语句可以嵌套,这使它拥有极大的灵活性和强大的功能。在多数情况下,在其他編程語言中需要用一大段程序才可实践的一个单独事件,而其在 SQL 上只需要一个语句就可以被表达出来。这也意味着用 SQL 語言可以写出非常复杂的语句。
SQL 語言包含4个部分:
- 數據查询語言(SELECT 语句)
- 數據操纵語言(INSERT, UPDATE, DELETE 语句)
- 數據定义語言(如 CREATE, DROP 等语句)
- 數據控制語言(如 COMMIT, ROLLBACK 等语句)
[编辑] 標準化
SQL was adopted as a standard by ANSI (American National Standards Institute) in 1992 and ISO (International Organization for Standardization) in 1987.
The SQL standard has gone through a number of revisions:
| 年代 | 版本名稱 | 代號 | 備註 |
|---|---|---|---|
| 1986 | SQL-86 | SQL-87 | First published by ANSI. Ratified by ISO in 1987. |
| 1989 | SQL-89 | Minor revision. | |
| 1992 | SQL-92 | SQL2 | Major revision (ISO 9075). |
| 1999 | SQL:1999 | SQL3 | Added regular expression matching, recursive queries, triggers, non-scalar types and some object-oriented features. (The last two are somewhat controversial and not yet widely supported.) |
| 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 provides facilities that permit 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. |
The SQL standard is not freely available. SQL:2003 and SQL:2006 may be purchased from ISO or ANSI. A late draft of SQL:2003 is available as a zip archive from Whitemarsh Information Systems Corporation. The zip archive contains a number of PDF files that define the parts of the SQL:2003 specification.
[编辑] 以 SQL 為基礎的其他延伸語言
- 微軟 SQL Server 系列資料庫所用的 SQL 語言
- Oracle 資料庫所使用的 SQL 語言
[编辑] 教学
[编辑] 参见
|
|
|
|---|---|
| 工业编程语言 | A+ - ActionScript - Ada - 汇编语言 - B - Brainfuck - COBOL - Curl - D - Delphi - Eiffel - Erlang - FORTRAN - IronPython - Java - JavaScript - JScript - Jython - LISP - Lua - MATLAB - MATHEMATICA - Nuva - Oberon - OCaml - Pascal - Perl - PHP - PostScript - Powerbuilder - Python - R - REXX - Ruby - Self - Smalltalk - SQL - Tcl/Tk - C# - F# - J# - Microsoft Visual C# |
| C/C++语言 | C - C++ - C++/CLI - Objective-C - Microsoft Visual C++ |
| BASIC语言 | BASIC - BASICA - GW-BASIC - QBASIC - QuickBASIC - True BASIC - Turbo BASIC - PowerBASIC - DarkBASIC -ETBASIC Visual Basic .NET - Visual Basic - VBScript - VBA |
| GPU用著色器語言 | Cg - GLSL - HLSL |
| 学术编程语言 | APL/J - Haskell - Logo - ML - Prolog - Scheme - SAC |
| 其他编程语言 | ALGOL - Clipper - Forth - Modula-2/Modula-3 - MUMPS - PL/I - Simula |




