Structured Query Language (SQL)λ︎
SQL is a domain-specific language designed for managing data held in a relational database management system (RDBMS), or for stream processing in a relational data stream management system (RDSMS).
SQL data incorporates relations among entities and variables.
Originally based upon relational algebra and tuple relational calculus, SQL consists of many types of statements, which may be informally classed as sublanguages, commonly:
- data query language (DQL)
- data definition language (DDL) (schema creation and modification)
- data control language (DCL)
- data manipulation language (DML) (insert, update, and delete)
SQL is a declarative language (4GL) which also includes procedural elements.
SQL Syntaxλ︎
The SQL language is subdivided into several language elements, including:
- Clauses, which are constituent components of statements and queries.
- Expressions, which can produce either scalar values, or tables consisting of columns and rows of data
- Predicates, which specify conditions that can be evaluated to SQL three-valued logic (3VL) (true/false/unknown) or Boolean truth values and are used to limit the effects of statements and queries, or to change program flow.
- Queries, which retrieve the data based on specific criteria. This is an important element of SQL.
- Statements, which may have a persistent effect on schemata and data, or may control transactions, program flow, connections, sessions, or diagnostics.
- SQL statements also include the semicolon (";") statement terminator. Though not required on every platform, it is defined as a standard part of the SQL grammar.
- Insignificant whitespace is generally ignored in SQL statements and queries, making it easier to format SQL code for readability.