SQL, a language for database management
SQL is convenient for managing large collections of data organized as lists of attributes. The classical activity of an enterprise, transactions and resources are perfectly managed by a such tool while processing intelligent information requires another format such as XML.
This is the most used language for building and using relational databases.
The original name was SEQUEL that is a short for "Structured English
QUEry Language", but was condensed to SQL and the full name "Structured
Query Language", come then. Must be pronounced S-Q-L.
The authors of the language are Donald D. Chamberlin and Raymond F. Boyce at IBM. The System/38 implemention was sold by IBM in 1979, while the Oracle software was created by Relational Software in the same year (this firm has been renamed Oracle further). In 1982 IBM implemented SQL in DB2.
SQL becomes an ANSI standard in 1986, an ISO standard in 1987 but actual implementations are far to be standardized.
SQL 2003 added XML features to the language.
The language has several variants and various procedural extensions depending on the editors.
- PL/SQL for Oracle.
- PS/PgSQL for PostgreSQL.
- SQL Procedural Language by IBM. This is a complete programming language.
- Transact SQL for MS SQL Server.
- Access by Microsoft and VBA (Visual Basic for Applications).
Features of a query language
In the relational model, queries are expressed declaratively as relations between categories of data (with "and", "or" operators mainly).
- SQL is intended mainly for query.
- Extended with procedural programming languages.
- Retrieval of data with functional queries.
- Uses tables and rows.
- Data manipulation functions:
- Delete entries, rows.
- Insert rows.
- Merge tables.
- Select articles.
- Update the content of a table.
- Data definition functions:
- Create a table, a row, ...
- Drop table, row, ...
- Control functions:
- Grant an user to perform an operation.
- Revoke a permission to an user.
- A comment has the form: -- some comment.
The main novelty of the 2003 version is the ability to process XML. In the 2006 version is defined precisely how to store XML and access the content with queries.
2008 and 2011 versions make minor modification.
Note that the 2013 version of PostgreSQL to store JSON code in the tables and access programmatically the content.
CREATE TABLE message (text char(15)); INSERT INTO message (text) VALUES ('Hello, World!'); SELECT text FROM message; DROP TABLE message;
Choose articles when cost is less than 50 $.
SELECT * FROM article WHERE price < 50
The main free SQL database managers are MySQL, supported by all shared hostings, SQLite for a single database, and PostgreSQL for intensive transactions.
Documents and references
- PostgreSQL vs. Oracle
Comparing a free tool with the most expensive système.
- SQL tutorial
with PHP and MySQL
Learn with examples how to use SQL on a website.
- Comparison. Difference between various implementations.
- SQL 92. The standard.
- SQL 2003. The standard.
- MySQL Tutorial. Reference manual for the more popular implementation of SQL.