Encyclopedia > SQL

  Article Content

Structured Query Language

Redirected from SQL

Structured Query Language, or SQL, is a programming language for use in quasi-relational databases. Many of the original SQL features were inspired by, but in violation of, tuple calculus, but recent extensions to SQL include a more relational algebra flavour.

SQL was originally created by IBM, but many vendors developed dialects of it. It was adopted as a standard by ANSI in 1986 and ISO in 1987.

SQL was revised in 1992, and that version is known as SQL-92. It was again revised in 1999 to become SQL:1999 (AKA SQL3). SQL:1999 supports objects, which weren't previously supported in other versions, but as of late 2001, few database management systems implement SQL:1999.

SQL, although defined by both ANSI and ISO, has many variations and extensions, most of which are of a proprietary nature, such as Oracle Corporation's PL/SQL or Sybase and Microsoft's Transact SQL[?]. It is also not uncommon for commercial implementations to omit support for basic features of the standard, such as the DATE or TIME data types, preferring some variant of their own. As a result in contrast to ANSI C or ANSI Fortran which can usually be ported from platform to platform without major structural changes, SQL code can rarely be ported between database systems without major modifications. Most people in the field believe that this lack of compatibility is intentional in order to force vendor lock-in in database systems.

As the name implies, SQL is designed for a specific, limited purpose -- querying data contained in a relational database. As such, it is a set-based programming language rather than a procedural language such as C or BASIC, which are designed to solve a much broader set of problems. Language extensions such as PL/SQL are designed to address this by adding procedural elements to SQL while maintaining SQL's advantages. Another approach is to allow procedural language code to be embedded in and interact with the database. For example, Oracle and others include Java in the database, while PostgreSQL allows functions to be written in Perl, Tcl, or C, among other languages.

In their SQL standard, the American National Standards Institute declared that the official pronunciation is "es queue el." However, many database professionals have taken to the "slang" pronunciation sequel,that reflects the language's original name, Sequel, before trademark conflicts caused IBM to perpetrate the current moniker.

One joke about SQL is that "SQL is neither Structured, nor a Language." This is (in part) founded on the notion that SQL isn't a Turing complete language.

Examples

Table 'X' Query Result
Y Z
1 a
2 b
Select * from X
Y Z
1 a
2 b
Y Z
1 a
2 b
Select Y from X
Y
1
2
Y Z
1 a
2 b
Select * from X where Y=1
Y Z
1 a
Given a table X, the query Select * from X will result in all the elements of all the rows of the table being shown.

With the same table, the query Select Y from X will result in the elements from the column Y of all the rows of the table being shown.

With the same table, the query Select * from X where Y=1 will result in all the elements of all the rows where the value of column Y is '1' being shown.

SQL syntax as of August 1992[?]

Database systems using SQL



All Wikipedia text is available under the terms of the GNU Free Documentation License

 
  Search Encyclopedia

Search over one million articles, find something about almost anything!
 
 
  
  Featured Article
Grand Prix

... dumped 2003-03-17 with ...

 
 
 
This page was created in 38.8 ms