Definition of Structured Query Language in the Network Encyclopedia.
What is Structured Query Language (SQL)?
SQL stands for Structured Query Language, a standards-based language used by relational database management programs primarily for constructing queries. Structured Query Language was originally developed by IBM for mainframe computing environments and is widely used in relational database management systems.
The standard version of SQL is defined by the American National Standards Institute (ANSI), but many vendors have made enhancements to its syntax and command functions. The latest SQL standard is called SQL-92 but is more properly known as ANSI standard SQL X3.135-1992 or International Organization for Standardization (ISO) standard ISO/IEC 9075:1992.
How It Works
SQL includes a number of statements that can be used to perform different types of relational operations on the contents of a database, including creating databases and database objects, modifying these objects, and querying databases for information. The most basic SQL statement is the SELECT statement, which you can use to retrieve rows and columns of data from database tables and format the results set. The typical format of a SELECT statement is
SELECT <columns> FROM <tables> WHERE <rows>
where a group of columns are retrieved from a table or tables in which data values are restricted to a particular row or rows. To return all the columns from a table, you can use a wildcard (but this is generally inefficient and should be avoided):
SELECT * FROM <tables>
Procedural extensions
SQL is designed for a specific purpose: to query data contained in a relational database. SQL is a set-based, declarative programming language, not an imperative programming language like C or BASIC. However, extensions to Standard SQL add procedural programming language functionality, such as control-of-flow constructs. Examples:
Source | Abbreviation | Full name |
---|---|---|
ANSI/ISO Standard | SQL/PSM | SQL/Persistent Stored Modules |
Interbase / Firebird | PSQL | Procedural SQL |
IBM DB2 | SQL PL | SQL Procedural Language (implements SQL/PSM) |
IBM Informix | SPL | Stored Procedural Language |
IBM Netezza | NZPLSQL | (based on Postgres PL/pgSQL) |
Invantive | PSQL | Invantive Procedural SQL (implements SQL/PSM and PL/SQL) |
Microsoft | T-SQL | Transact-SQL |
Mimer SQL | SQL/PSM | SQL/Persistent Stored Module (implements SQL/PSM) |
MySQL | SQL/PSM | SQL/Persistent Stored Module (implements SQL/PSM) |
MonetDB | SQL/PSM | SQL/Persistent Stored Module (implements SQL/PSM) |
NuoDB | SSP | Starkey Stored Procedures |
Oracle | PL/SQL | Procedural Language/SQL (based on Ada programming language) |
PostgreSQL | PL/pgSQL | Procedural Language/PostgreSQL Structured Query Language (implements SQL/PSM) |
SAP R/3 | ABAP | Advanced Business Application Programming |
SAP HANA | SQLScript | SQLScript |
Sybase | Watcom-SQL | SQL Anywhere Watcom-SQL Dialect |
Teradata | SPL | Stored Procedural Language |
Interoperability and standardization
SQL implementations are incompatible between vendors and do not necessarily completely follow standards. In particular date and time syntax, string concatenation, NULLs, and comparison case sensitivity vary from vendor to vendor.
Particular exceptions are PostgreSQL and Mimer SQL which strive for standards compliance, though PostgreSQL does not adhere to the standard in how folding of unquoted names is done. The folding of unquoted names to lower case in PostgreSQL is incompatible with the SQL standard, which says that unquoted names should be folded to upper case. Thus, Foo should be equivalent to FOO not foo according to the standard.