SQL
By ISO/ANSI
SQL (Structured Query Language) is the standard language for defining, querying, and manipulating data stored in relational database management systems. It lets users create tables, insert and update records, and retrieve data through…
Definition
SQL (Structured Query Language) is the standard language for defining, querying, and manipulating data stored in relational database management systems. It lets users create tables, insert and update records, and retrieve data through declarative statements that describe what result is wanted rather than the step-by-step procedure to get it. Standardized by ANSI and ISO, SQL is implemented with vendor-specific extensions by systems including PostgreSQL, MySQL, and many others, making it one of the most widely used languages in computing.
Overview
SQL was developed at IBM in the 1970s alongside the relational model, addressing the problem of how to query structured, tabular data without writing custom procedural code for every access pattern. Its declarative design lets a user specify the shape of the desired result set, and leaves the database engine responsible for figuring out the most efficient way to produce it, a separation of concerns that has proven durable across five decades of database engine evolution. Mechanically, SQL is organized into sublanguages: Data Definition Language (DDL) statements like CREATE TABLE define schema structure, Data Manipulation Language (DML) statements like SELECT, INSERT, UPDATE, and DELETE operate on data, and Data Control Language (DCL) statements manage permissions. A query planner inside the database engine parses a SQL statement, considers available indexes and statistics, and chooses an execution plan, meaning the same logical query can run very differently depending on the underlying engine and how the schema is indexed. SQL sits alongside query languages built for other data models rather than competing head-on with all of them: SPARQL serves RDF graph data, Cypher and Gremlin serve property graph databases, and XQuery and XPath operate over XML rather than relational tables. Within the relational world itself, SQL is largely universal, though PostgreSQL, MySQL, and other systems each extend the ANSI/ISO standard with their own procedural extensions and functions, so portable SQL and vendor-specific SQL are not quite the same thing in practice. In practice, SQL underlies most transactional business applications, reporting systems, and analytics pipelines, whether run against an on-premises relational database or a managed cloud service. Application developers embed SQL queries directly or through an object-relational mapper, while analysts write ad hoc SQL against data warehouses to answer business questions, and database administrators use its DDL and DCL statements to manage schema and access control. SQL's declarative style is also a source of friction for developers used to procedural or object-oriented code, since expressing complex business logic purely in SQL can become unwieldy, and query performance can be difficult to predict without understanding the underlying execution plan. It is not designed for hierarchical or highly connected data, where graph query languages or document stores often fit more naturally. Teams reach for SQL as the default for structured, relational data with well-defined schemas, and look elsewhere when data is naturally graph-shaped, schema-less, or requires extremely high write throughput that relational engines struggle to sustain.
Key Features
- Declarative syntax describing desired results rather than procedures
- Standardized by ANSI and ISO across relational database vendors
- Separate DDL, DML, and DCL sublanguages for schema, data, and access
- Supports joins across multiple tables based on relational keys
- Query optimizer chooses execution plans based on indexes and statistics
- Transactions with ACID guarantees for consistent multi-step operations
- Aggregate functions and grouping for summarizing large datasets
- Extended by vendors with procedural additions like PL/pgSQL or T-SQL