SQL Reference
|
This section documents standard SQL (ISO/IEC 9075-2 (SQL/Foundation)) functionality only. Vendor-specific extensions or behavior of any particular database management system are intentionally left out. In the US, the standard is also distributed via ANSI’s webstore (search "ISO/IEC 9075"). This content was generated with the assistance of AI and should be verified against your target DBMS’s own documentation before relying on it in production. |
Welcome to the standard SQL reference. This section is organized by statement family and function category so you can jump straight to what you need, or work through it top to bottom as a refresher.
What’s covered
-
Data Definition Language (DDL) —
CREATE,ALTER,DROP, and the standard constraint clauses used to define schemas, tables, views, and indexes. -
Relations — the standard relation types (1:1, 1:N, N:1, N:N), how each is modeled, and example join queries for each.
-
Querying data (SELECT) — the
SELECTclause order,DISTINCT,GROUP BY/HAVING,WHEREpredicates, and every standard join type. -
Modifying data —
INSERT,UPDATE,DELETE,MERGE, andTRUNCATE. -
Transactions — transaction control statements and standard isolation levels.
-
Data Control Language (DCL) —
GRANT,REVOKE, andSET. -
Built-in scalar functions — string, numeric, date/time, and type-conversion functions.
-
Aggregate and window functions —
COUNT/SUM/AVG/MIN/MAXand window functions such asROW_NUMBER,RANK, andLAG/LEAD. -
JSON and XML functions — the standard SQL:2016+ JSON functions and the standard XML functions.
-
Triggers and stored procedures —
CREATE TRIGGER,CREATE PROCEDURE, andCREATE FUNCTION(SQL/PSM). -
Normalization — functional dependencies, 1NF through BCNF with worked examples, and the normalization vs. denormalization trade-off.
-
Cheat sheet — a one-page, downloadable PDF summary of the statements above for quick memorization.
Bibliography
-
Kline, Kevin; Kline, Daniel; Hunt, Brand. SQL in a Nutshell, 3rd ed. O’Reilly Media, 2008. See the publisher’s page.
-
International Organization for Standardization / American National Standards Institute. ISO/IEC 9075, Information technology — Database languages — SQL. See ISO’s catalogue entry; also distributed via ANSI’s webstore.
-
ISO/IEC JTC 1/SC 32 committee page — free access to the committee’s scope, working groups, and project/standard status, maintained by the committee that develops SQL.