Fact-checked by Grok 2 weeks ago

SQL-92

SQL-92, formally known as ANSI X3.135-1992 (ISO/IEC 9075:1992), is an for the Structured (SQL), defining the syntax and semantics for creating, accessing, maintaining, controlling, and protecting data in management systems (RDBMS). Published in November 1992 by the (ISO) and the (IEC), it represents the third major revision of the SQL standard, succeeding ISO/IEC 9075:1989 (SQL-89) and introducing substantial enhancements while aiming for general compatibility with prior versions. The standard's primary goals include promoting portability of data definitions, enabling interconnection between SQL implementations, and supporting both in programming languages and direct invocation, thereby standardizing database operations across diverse systems. SQL-92 significantly expanded the language's capabilities compared to its predecessor, incorporating new data types such as DATE, TIME, TIMESTAMP, INTERVAL, bit strings, and support for multiple character sets and collations to handle diverse data more effectively. Key additions include advanced query expressions with set operators like UNION, EXCEPT, and INTERSECT (including the ALL option), various join types (INNER, LEFT OUTER, RIGHT OUTER, FULL OUTER, CROSS, and NATURAL), and CASE expressions for conditional logic. Schema management was bolstered with statements like ALTER TABLE, DROP, constraints (unique, referential, check, and assertions), domains, views with WITH CHECK OPTION, and an Information Schema for metadata access via standardized views. Other notable features encompass dynamic SQL support through PREPARE, DESCRIBE, and EXECUTE; transaction control with COMMIT, ROLLBACK, and isolation levels (e.g., READ UNCOMMITTED, SERIALIZABLE); cursor operations including scrolled cursors; and privilege management via GRANT and REVOKE. To facilitate adoption, SQL-92 defined three conformance levels—Entry SQL, Intermediate SQL, and Full SQL—allowing implementations to claim partial compliance while ensuring a baseline of core functionality at the Entry level. Entry SQL provides essential features like basic SELECT, INSERT, UPDATE, DELETE, and simple joins but excludes advanced elements such as datetime types, dynamic SQL, and certain set operators. Intermediate SQL builds on this by adding bit strings, some collations, and more join capabilities, while Full SQL requires support for the entire standard, including all data types, assertions, and diagnostics management via GET DIAGNOSTICS. These levels, along with specified binding styles (module, embedded, direct) and supported languages (e.g., C, , ), enabled vendors like and to integrate SQL-92 features into their RDBMS products, influencing modern database technologies despite subsequent revisions like SQL:1999.

Overview and History

Definition and Scope

SQL-92, informally known as the third major revision of the SQL standard, refers to the American National Standard ANSI X3.135-1992 and the identical International Standard ISO/IEC 9075:1992, marking the first comprehensive SQL specification extending beyond the entry-level features of prior versions. This standard evolved from the limited SQL-86 and SQL-89 editions, introducing a fuller set of language elements to support robust relational database operations. The scope of SQL-92 encompasses the syntax and semantics for defining, manipulating, and controlling access to data within management systems (RDBMS), including provisions for creation, data querying and modification, mechanisms, and handling to ensure data and . It applies to environments where SQL-data—structured as tables with rows and columns—is stored, retrieved, and managed, promoting portability across compliant implementations while allowing for implementation-defined extensions. The standard addresses core principles, such as relations, domains, and constraints, without prescribing specific hardware or software architectures. Under the formal title "Database Language SQL," the standard is divided into parts covering the framework (ISO/IEC 9075-1:1992), which outlines general concepts and conformance requirements; the foundation (ISO/IEC 9075-2:1992), detailing the primary language syntax and semantics; and integrity enhancements integrated within the foundation to support referential and check constraints. Its core components include the SQL Schema Definition Language (SDL) for creating and altering database structures like tables and views; the Data Manipulation Language (DML) for querying and updating data via statements such as SELECT, INSERT, UPDATE, and DELETE; the Data Control Language (DCL) for managing privileges with GRANT and REVOKE; and embedded SQL for integrating the language into host programming environments like C or COBOL. These elements collectively enable declarative programming of relational databases, emphasizing set-based operations over procedural code.

Development Timeline

The development of SQL-92 began with the ANSI X3H2 Database Technical Committee, which initiated work on advancing the SQL standard in 1986 following the approval of SQL-86 (ANSI X3.135-1986). This committee, originally formed in 1982 to standardize SQL syntax and semantics, focused on expanding the language's capabilities for broader commercial adoption. In 1989, the committee approved SQL-89 (ANSI X3.135-1989), an entry-level revision that added basic integrity enhancements and served as the foundation for subsequent full-scale development. From 1990 to 1991, X3H2 produced multiple working drafts for the comprehensive SQL standard, refining features through iterative reviews and key collaborative meetings, including ISO/IEC SC21/WG3 sessions in May 1991 to resolve defect reports on prior drafts. Major contributors to SQL-92 included prominent database vendors such as , , Sybase, and , which together represented over 85% of the market and provided technical input via the ANSI X3H2 and ISO working groups. The effort was chaired by Donald R. Deutsch of , ensuring alignment between industry needs and standardization goals. The primary objectives were to extend beyond SQL-89's entry-level constraints by introducing advanced features like full schema manipulation, dynamic SQL, and enhanced data types, thereby improving portability and interoperability for commercial management systems. This expansion aimed to support more robust applications while maintaining . SQL-92 was approved by ANSI as X3.135-1992 on January 4, 1993, following its adoption by ISO as ISO/IEC 9075:1992, published in November 1992.

Standardization Process

ANSI and ISO Adoption

The SQL-92 standard underwent a rigorous review process within the (ANSI), where the draft was examined by the Accredited Standards Committee X3H2, responsible for database languages. This committee, comprising representatives from industry and technical experts, refined the specification before forwarding it to the broader X3 committee for final approval. In 1992, ANSI X3 approved the document as American National Standard X3.135-1992, marking a significant expansion from prior versions by introducing advanced query capabilities and integrity features while maintaining where possible. Parallel to the ANSI efforts, the standard was advanced internationally through the (ISO). ANSI submitted the SQL-92 draft to the ISO/IEC Joint Technical Committee 1 Subcommittee 32 (JTC1/SC32) in 1990, initiating the global harmonization process. Recognizing the maturity of the ANSI work, ISO fast-tracked the adoption, approving it in 1992 as ISO/IEC 9075:1992, published in November 1992, which closely mirrored the ANSI text to promote worldwide interoperability. Harmonization between the ANSI and ISO versions was a key priority, involving joint reviews to align terminology, syntax, and requirements, thereby avoiding discrepancies that could hinder cross-border implementations. The ANSI X3.135-1992 publication consists of a single 288-page document encompassing the full specification, including core syntax and conformance guidelines. The ISO/IEC 9075:1992 is similarly organized as a single comprehensive document. Post-adoption, SQL-92 remained stable without immediate amendments, serving as the baseline for database implementations through the . The next major revision, , introduced object-relational extensions and was approved by both ANSI and ISO in , building directly on the SQL-92 foundation.

Compliance and Conformance Levels

SQL-92 (ISO/IEC 9075:1992) established a tiered system of conformance levels to accommodate varying degrees of implementation complexity, defining three levels—Entry SQL, SQL, and Full SQL—while the aligned U.S. Processing Standard (FIPS) 127-2 introduced an additional Transitional level between Entry and Intermediate, allowing database vendors to claim partial while progressing toward full adherence. The Entry SQL level, rooted in the prior SQL-89 standard and designated under FIPS 127-2 as the basic conformance tier, required support for fundamental manipulation operations, including simple SELECT statements for querying , along with basic INSERT, , and DELETE capabilities. This level emphasized core definition elements like creation and rudimentary data types, ensuring a minimal viable SQL interface without advanced constructs. Transitional SQL, an intermediate FIPS 127-2 level designed as a bridge from Entry SQL, extended these basics by mandating features such as view definitions for virtual tables and privilege management for , facilitating incremental upgrades in existing systems. It included additional query enhancements like basic joins and aggregate functions, but excluded more complex elements to maintain compatibility with legacy SQL-89 environments. Full SQL conformance demanded complete implementation of the SQL-92 specification, incorporating advanced components like module-based programming interfaces, deferred constraint checking, named constraints, and robust referential integrity mechanisms to maintain data consistency across relations. This level required adherence to all mandatory syntax, semantics, and processing rules outlined in the standard. Conformance certification was a voluntary process overseen by the National Institute of Standards and Technology (NIST), involving rigorous testing against FIPS 127-2 criteria; successful implementations received validation reports specifying supported features, binding styles (e.g., direct or embedded SQL), and any optional extensions. NIST's test suites verified compliance by executing standardized SQL statements and checking results for correctness. The standard differentiated core features—mandatory across levels, such as basic queries and data types—from optional ones, including recursive queries and certain datetime functions, which allowed flexibility for vendor-specific optimizations without violating conformance claims. By structuring compliance this way, SQL-92 promoted partial implementations in simpler or cost-sensitive applications while incentivizing full adoption in enterprise settings, thereby enhancing portability and reducing over time.

Core Language Components

Schema Definition Language

The Schema Definition Language (SDL) in SQL-92 constitutes the subset of the standard dedicated to defining, modifying, and removing the structural components of a , including schemas, tables, views, and associated constraints. As specified in ISO/IEC 9075:1992, SDL enables the creation of namespaces and the specification of types, defaults, and integrity rules to ensure data consistency across the database. This language operates at the schema level, distinct from data manipulation, by focusing on and structural integrity rather than content insertion or retrieval. The CREATE SCHEMA statement establishes a named as a namespace within a , allowing for organized grouping of database objects such as tables and views. Its syntax is CREATE SCHEMA <schema name> [AUTHORIZATION <schema authorization identifier>] [<schema element>... ], where the optional authorization clause designates the owner (e.g., a or ) responsible for the schema; if omitted, the current SQL-session authorization identifier applies. For example:
sql
CREATE SCHEMA personnel AUTHORIZATION hr_manager;
This creates a schema named personnel owned by hr_manager, providing isolation for related objects and preventing naming conflicts across catalogs. Schemas in SQL-92 support set specifications for , enhancing portability. SQL-92 standardizes a core set of data types for column definitions, promoting among implementations. These include strings ([CHARACTER](/page/Character) for fixed-length and CHARACTER VARYING for variable-length), exact numerics (NUMERIC and [DECIMAL](/page/Decimal) with precision and scale), approximate numerics ([FLOAT](/page/Float) and REAL), bit strings (BIT for fixed-length and BIT VARYING for variable-length), dates and times ([DATE](/page/Date) for calendar dates, TIME for clock times, and [TIMESTAMP](/page/Timestamp) for combined date-time values), and intervals ([INTERVAL](/page/Interval) for durations, such as INTERVAL YEAR TO MONTH). The following table summarizes these types with examples:
Data TypeDescriptionExample Syntax
Fixed-length character stringsCHARACTER(20)
NUMERICExact numeric with specified precision and scaleNUMERIC(10, 2)
BITFixed-length bit stringsBIT(8)
DATE (YYYY-MM-DD)DATE
TIMESTAMPDate and time (YYYY-MM-DD HH:MI:SS)TIMESTAMP
INTERVAL between datetimesINTERVAL HOUR TO MINUTE
These types form the foundation for column specifications in table definitions, with additional user-defined domains allowed for reuse. The CREATE TABLE statement defines a base table with columns, defaults, and constraints to enforce structural rules. Its syntax is CREATE TABLE <table name> (<table element>...), where each <column definition> takes the form <column name> <data type> [DEFAULT <default option>] [<column constraint>...]. Defaults can be literals, NULL, or system-generated values, while constraints include PRIMARY KEY for unique non-null identifiers, UNIQUE for value uniqueness allowing nulls, NOT NULL to prohibit nulls, and CHECK for conditional validation on column values. Table-level constraints extend these to multiple columns, such as composite primary keys. An example is:
sql
CREATE TABLE employees (
    emp_id INTEGER NOT NULL [PRIMARY KEY](/page/Primary_key),
    name CHARACTER VARYING(50) [DEFAULT](/page/Default) 'Unknown',
    salary NUMERIC(10,2) [CHECK](/page/Check) (salary > 0),
    dept_id INTEGER [REFERENCES](/page/List_of_cricket_commentators) departments(dept_id)
);
This defines a with integrity rules integrated at creation time. Temporary tables (GLOBAL TEMPORARY or LOCAL TEMPORARY) are also supported for session-specific structures. Modifications to existing tables are handled by the ALTER TABLE statement, with syntax ALTER TABLE <table name> <alter table action>. Actions include adding columns (ADD [COLUMN] <column definition>), altering column properties (ALTER [COLUMN] <column name> <alter column action>, such as setting or dropping ), and adding or dropping (ADD <table constraint definition> or DROP CONSTRAINT <constraint name>). For instance, ALTER TABLE employees ADD COLUMN hire_date DATE; appends a new column without affecting existing data, while ALTER TABLE employees ALTER COLUMN salary SET [DEFAULT](/page/Default) 50000; updates the default value. Dropping columns or constraints follows similar patterns, with restrictions to maintain . Removal of structures uses DROP statements: DROP SCHEMA <schema name> [RESTRICT | CASCADE] deletes the schema and its contents (with CASCADE removing dependents or RESTRICT failing on dependencies); DROP TABLE <table name> [RESTRICT | CASCADE] removes a table; and DROP VIEW <view name> [RESTRICT | CASCADE] eliminates a view. These operations ensure controlled cleanup, with cascade options propagating deletions to preserve consistency. Assertions provide a mechanism for schema-wide constraints beyond table-level checks, using CREATE ASSERTION <assertion name> CHECK (<search condition>). This enforces complex conditions, such as cross-table rules (e.g., CREATE ASSERTION total_employees CHECK ((SELECT COUNT(*) FROM employees) < 1000);), which are evaluated globally during data changes. Assertions, along with CHECK clauses, support declarative integrity, tying into broader enforcement mechanisms without involving data control privileges directly.

Data Manipulation Language

The Data Manipulation Language (DML) in SQL-92 provides statements for retrieving, inserting, modifying, and deleting data within database tables, forming the core mechanism for interacting with persistent data storage. These operations operate on tables defined in the Schema Definition Language, enabling applications to manage relational data efficiently. SQL-92's DML builds on prior standards by standardizing syntax for searched operations and cursor-based processing, ensuring portability across compliant database management systems (DBMS). The INSERT statement adds new rows to a , supporting single rows, multiple rows via value lists, or rows derived from subqueries. Its syntax is <insert statement> ::= INSERT INTO <table name> [ (<insert column list>) ] <query expression> | DEFAULT VALUES, where <query expression> can be a subquery or a table value constructor like VALUES (row1), (row2). For example, INSERT INTO employees (name, salary) VALUES ('Alice', 50000), ('Bob', 60000); inserts multiple rows directly, while INSERT INTO employees SELECT name, salary FROM temp_employees; uses a subquery as the source. The DEFAULT VALUES variant inserts a row with default values for unspecified columns, equivalent to providing defaults explicitly. These features allow flexible data population while enforcing where applicable. The statement modifies existing rows in a using searched conditions. Its syntax is <update statement: searched> ::= [UPDATE](/page/Update) <table name> SET <set clause list> [ WHERE <search condition> ], where <set clause list> assigns values to columns, such as SET salary = salary * 1.1, department = 'IT'. The optional WHERE clause, employing a <search condition> like WHERE department = 'Sales', targets specific rows; omitting it updates all rows. Positioned updates via cursors, using WHERE CURRENT OF <cursor name>, enable row-by-row modifications in contexts. This supports bulk or selective changes, with SQL-92 specifying rules for handling nulls and constraints during assignment. The DELETE statement removes rows from a , also via searched conditions. Its syntax is <delete statement: searched> ::= DELETE FROM <table name> [ WHERE <search condition> ]. The WHERE clause filters rows, for instance, DELETE FROM employees WHERE [salary](/page/Salary) < 30000;; without it, all rows are deleted, effectively truncating the table (though SQL-92 distinguishes this from the non-standard TRUNCATE). Positioned deletes use WHERE CURRENT OF <cursor name> for cursor-driven removal. These operations cascading actions if defined in referential constraints, ensuring data consistency. The SELECT statement retrieves data through a basic query specification. Its syntax is <query specification> ::= SELECT [ DISTINCT ] <select list> FROM <table reference> [ WHERE <search condition> ] [ GROUP BY <grouping column reference list> ] [ HAVING <search condition> ] [ ORDER BY <sort specification list> ]. The FROM clause specifies source tables, WHERE filters rows (e.g., WHERE age > 30), GROUP BY aggregates by columns (e.g., GROUP BY department), HAVING applies conditions to groups (e.g., HAVING COUNT(*) > 5), and ORDER BY sorts results (e.g., ORDER BY salary DESC). The DISTINCT quantifier eliminates duplicate rows. This structure supports foundational querying, with results treated as derived tables for further operations. Embedded SQL integrates DML into host languages like C or COBOL, using cursors for iterative processing. The DECLARE CURSOR statement defines a cursor with <declare cursor> ::= DECLARE <cursor name> CURSOR FOR <query expression>, specifying the query. OPEN executes it via <open statement> ::= OPEN <cursor name>, FETCH retrieves rows with <fetch statement> ::= FETCH [ <fetch orientation> ] FROM <cursor name> INTO <target list>, supporting orientations like NEXT or PRIOR, and CLOSE releases resources with <close statement> ::= CLOSE <cursor name>. These precompiled statements enable dynamic data access in procedural code, with SQL-92 defining scoping rules for module-level declarations. SQL-92 supports set operations on query results via UNION, EXCEPT, and INTERSECT, combining multiple <query expression>s. The general form is <query expression body> ::= <query term> | <query expression body> { UNION | EXCEPT | INTERSECT } [ ALL ] <query term>, processed left-to-right with parentheses for precedence. UNION concatenates rows, removing duplicates unless ALL is specified (e.g., SELECT name FROM employees UNION SELECT name FROM contractors;). EXCEPT returns rows from the left query absent in the right (e.g., SELECT * FROM products EXCEPT SELECT * FROM sold_items;), while INTERSECT yields common rows (e.g., SELECT department FROM sales INTERSECT SELECT department FROM marketing;). Operands must match in degree and type, with ALL preserving duplicates based on counts; results are unordered unless ORDER BY is added. These operations enhance query expressiveness for set-based comparisons.

Data Control Language

The Data Control Language (DCL) in SQL-92 provides mechanisms for controlling access to database objects and schemas, enabling administrators to manage privileges and ensure through explicit . It focuses on defining who can perform operations on tables, views, and schemas, distinguishing between ownership and delegated permissions to prevent unauthorized modifications or queries. Privileges are granted to authorization identifiers, such as s or the special identifier representing all users. The GRANT statement assigns specific privileges to users or groups, specified as <grant statement> ::= GRANT <privileges> TO <grantee> [WITH GRANT OPTION], where privileges include SELECT (for querying data), INSERT (for adding rows), (for modifying rows or columns), DELETE (for removing rows), and (for creating foreign keys). These privileges apply to tables and views, with column-level granularity possible (e.g., UPDATE on specific columns), and the optional WITH GRANT OPTION allows the grantee to further delegate those privileges to others. For comprehensive access, ALL PRIVILEGES grants every applicable privilege on the object. Complementing GRANT, the REVOKE statement withdraws privileges using the syntax <revoke statement> ::= REVOKE [GRANT OPTION FOR] <privileges> FROM <grantee> [CASCADE | RESTRICT]. The CASCADE option propagates the revocation to any dependent privileges granted by the affected user, while RESTRICT aborts the operation if such dependencies exist, ensuring controlled removal of access rights. Schema authorization establishes ownership through the CREATE SCHEMA statement, which includes an AUTHORIZATION clause: <schema definition> ::= CREATE SCHEMA <schema name> AUTHORIZATION <authorization identifier>. This designates the specified user as the schema owner, who holds implicit privileges over all objects within it and sets the context for subsequent privilege checks. Privileges on views are handled independently from those on underlying tables, requiring separate GRANT or REVOKE operations for the view itself. However, accessing a view typically demands SELECT privileges on its base tables, ensuring that view definitions do not bypass table-level . Default privileges are managed via the special authorization identifier, which automatically confers basic access—such as USAGE on character sets, collations, and translations—to all users without explicit grants. Administrators can override these by granting or revoking from , providing a baseline for anonymous or broad access while allowing fine-tuned restrictions.

Key New Features

Query Enhancements

SQL-92 introduced significant advancements in query expressiveness, building upon the foundational SELECT statement from prior standards to enable more complex data retrieval and manipulation. These enhancements allowed for richer join operations, nested queries, conditional logic, and aggregated computations, facilitating more efficient and readable queries without relying on procedural extensions. Key features include formalized join syntax, subquery capabilities, aggregate functions with deduplication options, and conditional expressions, all defined in the ANSI X3.135-1992 standard. One of the most impactful additions was the standardization of outer joins, which extended the basic inner join to include unmatched rows from one or both tables. SQL-92 specifies LEFT OUTER JOIN, RIGHT OUTER JOIN, and FULL OUTER JOIN, each paired with an ON clause to define the join condition. For instance, a LEFT OUTER JOIN includes all rows from the left table and matching rows from the right table, filling non-matching right-table rows with values. The syntax is defined as <table reference> LEFT [OUTER] JOIN <table reference> ON <search condition>, enabling precise control over result sets that preserve during relational combinations. This formalized previously ad-hoc implementations of outer joins in vendor dialects. Complementing joins, SQL-92 enhanced subquery support with scalar and correlated variants, allowing nested queries to integrate seamlessly into SELECT, WHERE, and other clauses. A scalar subquery returns a single value and can be used wherever an expression is expected, such as in a WHERE like SELECT * FROM employees WHERE salary > (SELECT AVG(salary) FROM departments). If the subquery yields more than one row, a violation error occurs. Correlated subqueries, which reference columns from the outer query (termed "outer references"), are evaluated repeatedly for each outer row, enabling dynamic filtering; an example is SELECT * FROM orders o WHERE EXISTS (SELECT 1 FROM shipments s WHERE s.order_id = o.id). These features expanded query power for complex filtering and aggregation without multiple statements. Aggregate functions in SQL-92 were refined to support COUNT(*), SUM, AVG, MIN, and MAX, with the optional DISTINCT keyword to eliminate duplicates before computation. For example, SELECT COUNT(DISTINCT department_id) FROM employees counts unique departments, ignoring NULLs and repeats. The syntax for these set functions is <set function specification> ::= <set function type> ( [ <set quantifier> ] <value expression> ), where <set function type> is COUNT (optionally with <asterisk>), SUM, AVG, MIN, or MAX, and <set quantifier> is [DISTINCT | ALL] (ALL is the default), applied over grouped or ungrouped data to produce summary values. This capability streamlined analytical queries by reducing the need for preliminary DISTINCT operations. The CASE expression provided a mechanism for conditional logic directly within queries, evaluating conditions sequentially and returning the corresponding result. SQL-92 defines two forms: the simple CASE (CASE <case operand> WHEN <when operand> THEN <result> ... [ELSE <result>] END) for equality checks, and the searched CASE (CASE WHEN <condition> THEN <result> ... [ELSE <result>] END) for arbitrary predicates. An illustrative query is SELECT employee_id, CASE WHEN salary > 50000 THEN 'High' ELSE 'Standard' END AS salary_band FROM employees. This expression, introduced in the intermediate level of SQL-92 conformance, enhanced query flexibility for derived columns and decision-based outputs. Finally, SQL-92 formalized the INNER JOIN syntax, replacing comma-separated lists and WHERE-based conditions with explicit JOIN clauses for clarity and maintainability. Theta-style joins, including non-equality conditions, are supported via <table reference> INNER JOIN <table reference> ON <search condition>, such as SELECT * FROM products p INNER JOIN categories c ON p.category_id = c.id AND p.price > 100. This approach separates join logic from filtering, reducing in complex queries and aligning with principles.

Integrity Constraints

SQL-92 introduced a comprehensive for constraints to maintain and validity within relational , defining rules that restrict the permissible states of SQL-data at column, , , and levels. These constraints are declaratory, specified during definition, and enforced by the (DBMS) during manipulation operations such as INSERT, , and DELETE. Unlike prior standards, SQL-92 expanded support for deferrable constraints, allowing temporary violations within a to accommodate complex updates, with final enforcement at commit time. Column-level constraints in SQL-92 include NOT and , which ensure basic . The NOT constraint prohibits null values in a specified column, declared as part of the column definition: <column name> <data type> NOT NULL. This prevents incomplete and is implicitly included in definitions. The constraint ensures that no two rows have identical values in the specified column or set of columns, allowing nulls unless combined with NOT NULL: <column name> <data type> UNIQUE or as a table constraint UNIQUE (<column name list>). combines UNIQUE and NOT NULL, limited to one per , and serves as the target for referential actions. CHECK constraints enforce domain-specific rules via boolean search conditions on single columns or across tables. At the column level, they are defined as CHECK (<search condition>), such as CHECK (salary > 0), restricting values to satisfy the . Table-level CHECK constraints apply to multiple columns or rows, for example, CHECK (end_date > start_date), and may include subqueries in full SQL-92 (though not in Entry SQL). These constraints can be named for management, e.g., CONSTRAINT valid_range CHECK (value BETWEEN 0 AND 100). Referential integrity, a of SQL-92, is maintained through constraints that link tables by ensuring foreign key values match existing primary or unique keys in the referenced table. The syntax is FOREIGN KEY (<referencing column list>) REFERENCES <referenced table> [(<referenced column list>)], such as FOREIGN KEY (dept_id) REFERENCES departments(dept_id). SQL-92 supports deferrable referential constraints, declared as DEFERRABLE [INITIALLY IMMEDIATE | INITIALLY DEFERRED], enabling checks to be postponed until end using SET CONSTRAINTS <constraint name> DEFERRED. Triggered actions handle deletions or updates: ON DELETE [CASCADE](/page/Cascade) propagates changes, ON DELETE SET [NULL](/page/Null) nullifies references, ON DELETE SET DEFAULT applies defaults, or [RESTRICT](/page/Restrict)/NO ACTION prevents violating operations. Partial nulls in composite foreign keys are disallowed; all components must be null or fully match. Domain constraints extend data typing via CREATE DOMAIN, allowing user-defined types with built-in restrictions. The syntax is CREATE DOMAIN <domain name> AS <data type> [DEFAULT <value>] [CHECK (<search condition>)], for example, CREATE DOMAIN positive_int AS INTEGER CHECK (VALUE > 0). This reusable type inherits the base type's properties but adds validation, such as range checks or enumerated values, ensuring consistent application across columns. Domains support collations and can be referenced in views like DOMAINS for inspection. Global integrity is enforced through assertions, which are schema-level predicates checked across the entire database. Defined as CREATE ASSERTION <assertion name> CHECK (<search condition>), they handle complex, multi-table rules not feasible at lower levels, such as CREATE ASSERTION sum_constraint CHECK ((SELECT [SUM](/page/Sum)(amount) FROM [loan](/page/Loan)) <= (SELECT SUM(balance) FROM [account](/page/account))). Assertions can involve aggregates and subqueries but are not supported in Intermediate SQL; they are managed via the ASSERTIONS view. Like other constraints, they may be deferrable. Enforcement of all integrity constraints occurs automatically during data modification statements, with violations raising standardized exceptions via codes in the diagnostics area. The class 23000 signals general integrity constraint violations, such as foreign key mismatches or failed CHECKs; subclasses provide granularity (e.g., 23503 for foreign key violations in some implementations, though SQL-92 defines the structure). Deferrable constraints are evaluated at transaction commit, while non-deferrable ones trigger immediate errors. The GET DIAGNOSTICS statement retrieves these codes, replacing the deprecated SQLCODE, ensuring portable error handling. Constraint metadata is accessible through views like TABLE_CONSTRAINTS, REFERENTIAL_CONSTRAINTS, and CHECK_CONSTRAINTS.

Differences from Prior Standards

Changes from SQL-89

SQL-92 represented a significant expansion from the entry-level features of SQL-89, transforming it into a more comprehensive database language standard. While SQL-89, formalized as ANSI X3.135-1989, focused primarily on basic data definition, , and integrity constraints in a roughly 120-page document, SQL-92 (ANSI X3.135-1992) ballooned to approximately 579 pages, with the majority—over 80%—comprising new content to support intermediate and full conformance levels. This growth enabled the addition of modules for grouping declarations of cursors and variables in environments. The entry-level conformance in SQL-92 remained largely compatible with SQL-89, incorporating its core data but augmenting it with enhanced integrity constraints. A key aspect of SQL-92 was the unification of syntax, particularly in join operations, which standardized explicit join notation to replace the vendor-specific comma-separated table lists and WHERE clause conditions prevalent in SQL-89 implementations. This included the introduction of INNER JOIN, OUTER JOIN variants (such as LEFT, RIGHT, and FULL OUTER JOIN), CROSS JOIN, and NATURAL JOIN, providing a consistent framework that reduced ambiguities and improved portability across database systems. These enhancements briefly reference outer joins as a specific improvement for handling incomplete data relationships, without altering the core from SQL-89. SQL-92 also introduced new clauses to refine query capabilities, such as supporting DISTINCT within aggregate functions like COUNT(DISTINCT) to eliminate duplicates in summations. Furthermore, SQL-92 clarified several ambiguities from SQL-89 regarding handling in s, reinforcing that any involving evaluates to to ensure consistent across all data types. This clarification, along with explicit predicates, promoted more reliable query results in scenarios involving .

Backward Compatibility Issues

One significant challenge in adopting SQL-92 arose from partial compliance in existing database systems, which often supported only the entry-level subset equivalent to SQL-89 but lacked advanced features like full outer joins. This meant that applications relying on SQL-89's limited join capabilities could fail when attempting SQL-92's expanded outer join syntax, such as LEFT, RIGHT, or FULL OUTER JOIN, which were not standardized in prior versions. Despite overall , SQL-92 included some minor , such as refined syntax rules, noted in the standard's compatibility annex. Syntax conflicts further complicated migrations, particularly with the shift from SQL-89's comma-separated table lists in the FROM clause combined with join conditions in the WHERE clause to SQL-92's explicit keywords. For instance, a query like SELECT * FROM table1, table2 WHERE table1.id = table2.id in SQL-89 would need rewriting to SELECT * FROM table1 INNER [JOIN](/page/Join) table2 ON table1.id = table2.id for SQL-92 compliance, as the older theta-style joins risked or unintended Cartesian products in complex queries. These differences could lead to parser errors in systems transitioning without full modes. SQL-92 deprecated several holdovers from SQL-86 and SQL-89 to streamline the language, including the rudimentary module structures for and certain parameter declaration syntaxes without enclosing parentheses. For example, the SQLCODE status parameter, carried over from earlier standards for error handling, was marked as deprecated in favor of the more robust , potentially breaking legacy embedded applications that did not update their diagnostics. Annex D of the SQL-92 standard lists these features explicitly to guide implementers toward future-proofing while maintaining minimal support for transition. To address these issues, strategies often involved creating views to emulate unsupported outer joins or layers, such as wrapping SQL-89 queries in views that leverage SQL-92's explicit syntax. Parser adjustments in database engines were also common, allowing dual-mode processing to interpret both old comma-separated joins and new explicit ones without immediate rewrites. These approaches minimized disruptions but required careful testing to avoid subtle behavioral changes, like implementation-dependent row ordering in unordered cursors noted in SQL-92's annex. In real-world scenarios during the early , databases like Oracle 7 exemplified partial support pitfalls, certified only for SQL-92 entry-level , which led to errors when applications attempted or full-level features such as advanced outer joins or enhancements. Users migrating from SQL-89 often encountered syntax rejection or unexpected results, prompting iterative query refactoring to align with the limited conformance level.

Implementations and Extensions

Vendor-Specific Support

Major database vendors in the 1990s implemented SQL-92 features to varying degrees, often claiming entry-level conformance and gradually adding support for intermediate levels. Vendors self-reported compliance based on the SQL Test Suite developed by NIST for FIPS PUB 127-2, focusing on core data definition, manipulation, and control elements, but higher levels like full SQL-92 were rarely achieved due to complexity.
VendorVersion and YearConformance LevelKey Notes
IBM DB2Version 5 (1997)EntryEmphasized integrity constraints and module language. Supported advanced features toward intermediate level.
OracleOracle 8 (1997)Entry and IntermediateSupported features like TRIM and UNION in views. Partial transitional elements included; full intermediate compliance in later releases.
Microsoft SQL ServerVersion 6.0 (1995); 6.5 (1996)Partial Entry in 6.0; Transitional in 6.56.0 introduced broader SQL-92 query enhancements like outer joins and subqueries.
SybaseAdaptive Server 11.0 (1994); 11.5 (1996)Core support in 11.0 with gaps; Entry in 11.511.0 added SQL-92 security and permissions but lacked full assertion support.
IngresIngres II (1995)EntryFocused on basic DDL and DML compliance.
IBM's DB2 Version 5 demonstrated robust support for SQL-92's integrity constraints, including declarative checks and . Oracle's adoption in Version 8 provided transitional features such as implicit casting and grouped operations, with expanded predicates in later versions. SQL Server's progression from partial entry-level in Version 6.0 to transitional in included better handling of outer joins and subqueries. Sybase's Adaptive Server 11.0 offered core SQL-92 data manipulation but omitted advanced features like assertions for complex constraints. These implementations established a baseline for commercial use in the late , though full SQL-92 conformance remained limited across vendors.

Common Proprietary Extensions

While SQL-92 provided foundational support for stored procedures through basic callable routines, vendors significantly enhanced this capability to include full languages. Oracle's , for instance, extends SQL-92 by integrating procedural constructs such as loops, conditional statements, , and packages for modular code organization, allowing developers to create complex, database-resident applications that go beyond the standard's non-procedural focus. Similarly, introduced (T-SQL) extensions, enabling stored procedures with advanced flow control and integration with .NET assemblies, which facilitated not native to SQL-92. These enhancements improved performance by reducing network traffic and centralizing logic, becoming standards for database development. Advanced data types for handling large objects, such as (Binary Large Object) and (Character Large Object), were not part of SQL-92's core specification, which relied on simpler types like LONG for extended text; vendors added them as proprietary features to manage multimedia and . implemented and in its database from Oracle 8 (1997) onward, initially supporting up to 4 GB of binary or character data stored separately from table rows to optimize space and access (limits increased to 128 TB in later versions like 12c). followed suit with similar LOB types, including DBCLOB for double-byte characters, enabling efficient storage of documents and images in relational tables starting from Version 5 (1997). These additions addressed real-world needs for scalable , influencing later standards while establishing vendor-specific syntax for LOB operations like partial updates and streaming. SQL-92's CREATE INDEX statement supported basic indexes for query optimization, but vendors introduced specialized index types to handle diverse workloads. Oracle's indexes, a extension introduced in version 7.1 (1994), use bit vectors to represent low-cardinality columns (e.g., or status flags), dramatically reducing for warehouses by compressing multiple row identifiers into bitmaps and speeding up ad-hoc analytical queries through bitwise operations. In contrast, extended indexing with filtered indexes (introduced in SQL Server ), which allow conditional inclusion of rows based on predicates, and columnstore indexes for compressing columnar in analytical processing—features absent from SQL-92 that enhance selectivity and compression for OLAP scenarios. These innovations improved query performance on large datasets, with indexes particularly effective for join-heavy environments. Error handling in SQL-92 relied on standard variables like SQLCODE (an integer status code) and (a five-character string), but vendors expanded these with proprietary codes and mechanisms for finer diagnostics. augments SQLCODE with over 20,000 unique error numbers in its ORA- , providing detailed messages for issues like violations or limits, accessible via the SQLCA or built-in functions like SQLERRM. extends SQLCODE similarly, with vendor-specific values (e.g., -104 for syntax errors) and SQLSTATE classes tailored to its engine, including support for user-defined exceptions in stored procedures. Such expansions enabled robust application-level recovery, turning generic standard codes into actionable, system-specific insights. Many proprietary extensions from the SQL-92 era paved the way for SQL:1999 by demonstrating practical needs that the standards body later formalized. For example, recursive queries for hierarchical data—unsupported in SQL-92—were implemented proprietarily by vendors like (via CONNECT BY PRIOR in version 7, 1992) and (early recursive common table expressions in 1997), handling structures such as organizational charts or bill-of-materials efficiently through iterative processing. These vendor solutions influenced SQL:1999's introduction of standardized recursive WITH clauses, which generalized the approach using union-based , thereby incorporating proven de facto mechanisms into the core language while reducing portability barriers.

Legacy and Impact

Influence on Later SQL Standards

SQL-92, formally known as ISO/IEC 9075:1992, laid the foundational structure for subsequent revisions of the SQL standard, particularly serving as the baseline for (ISO/IEC 9075:1999). This standard introduced modules for organizing SQL schemas and routines, which extended by incorporating object-relational features such as structured user-defined types, inheritance, and methods, enabling more advanced database designs while preserving SQL-92's core relational framework. Key elements from SQL-92, including its explicit join syntax (e.g., INNER JOIN, LEFT OUTER JOIN) and integrity constraints (e.g., , , ), were adopted unchanged into later standards like SQL:2003 (ISO/IEC 9075:2003) and SQL:2008 (ISO/IEC 9075:2008), ensuring continuity in query formulation and data validation across implementations. These features provided a stable core for enhancements in subsequent versions, such as XML integration in SQL:2003 and OLAP operations in SQL:2008. The full conformance level of SQL-92 became the baseline for revisions of ISO/IEC 9075, influencing the modular structure adopted from SQL:1999 onward, where the standard is divided into multiple parts covering frameworks, foundation, and extensions. Minor amendments addressed errata through technical corrigenda, including one in 1994 and another in 1996, which corrected ambiguities without altering core syntax. These updates were followed by the publication of ISO/IEC 9075-3:1995 (SQL/CLI), standardizing a call-level for dynamic SQL execution. SQL-92's standardization efforts had a global impact by forming the basis for application programming interfaces like ODBC and JDBC in the 1990s, with ODBC aligning to the SQL/CLI specification for cross-database connectivity and JDBC providing a Java-specific binding compliant with SQL-92 entry-level features. This compliance enabled interoperability among diverse database systems.

Modern Relevance and Deprecation

Despite its age, SQL-92 remains a foundational element in modern database management systems (DBMS), with core features supported for to ensure legacy applications continue to function without modification. For instance, conforms to the SQL-92 entry level and supports most of its mandatory features as part of its broader compliance with SQL:2023, allowing seamless execution of SQL-92 queries in contemporary environments. Similarly, maintains compatibility with SQL-92 syntax and semantics, treating it as a baseline for relational operations in versions up to 8.4, which facilitates and portability for older codebases. This widespread support underscores SQL-92's enduring role in maintaining across diverse systems. SQL-92 has been largely superseded by subsequent ISO/IEC 9075 standards, including SQL:2016 and the current SQL:2023, which introduce advanced capabilities absent in the 1992 version. Historically, SQL-92 formed the basis for Federal Information Processing Standard (FIPS) PUB 127-2, which mandated its use in U.S. government systems for database until the standard's in 2005. In 2025, there is no active development or revision of SQL-92; it is merely referenced in ISO maintenance documents for historical context and conformance testing, with focus shifted to evolving standards that address contemporary data challenges. In educational settings, SQL-92 serves as a historical and introductory framework in database courses, providing students with essential relational concepts before exploring modern extensions. Many university curricula and textbooks still emphasize SQL-92 syntax for its clarity and completeness in core operations like joins and subqueries. However, its practical limitations in current applications are evident: it lacks support for data handling, introduced in SQL:2016, and window functions for advanced analytics, added in SQL:1999. For these reasons, migration to at least SQL:2008 is recommended for new developments to leverage features like temporal tables and improved XML support, ensuring scalability and alignment with industry needs.

References

  1. [1]
    International Standard ISO/IEC 9075:1992
    ... SQL X3H2-92-154/DBL CBR-002 Foreword ISO (the International Organization for ... g) descriptor: A coded description of an SQL object. It includes all ...
  2. [2]
    Introduction, 1 of 2
    SQL-92 defined four levels of compliance: Entry, Transitional, Intermediate, and Full. A conforming SQL implementation must support at least Entry SQL. Oracle8i ...
  3. [3]
    The SQL Standard - ISO/IEC 9075:2023 (ANSI X3.135)
    Oct 5, 2018 · SQL is the standard language for relational database management, used for querying, controlling access, and updating data. The current standard ...
  4. [4]
    [PDF] ANSI X3.135-1992, Database Language SQL—January 4, 1993
    Jan 4, 1993 · 135-1992, Database Language—SQL), is a re- vision of American National Standard X3. ... This American Standard was developed from ANSI X3.135-1989 ...
  5. [5]
    ISO/IEC 9075:1992 - Information technology — Database languages
    General information ; Publication date. : 1992-11 ; Stage. : Withdrawal of International Standard [95.99] ; Edition. : 3 ; Number of pages. : 587 ; Technical ...
  6. [6]
    SQL-92
    SQL-92 was developed by the ANSI (then NCITS, and now INCITS) X3H2 committee, which originally began work on a SQL standard in 1982. SQL-92 does not address ...Missing: timeline | Show results with:timeline
  7. [7]
    The Role of NIST in SQL Standardization - TDAN.com
    Sep 1, 1997 · Published. in late 1992 as ANSI X3.135-1992 and ISO/IEC 9075:1992, and commonly called SQL-92, this standard has proved to be a major event in ...Missing: definition | Show results with:definition
  8. [8]
    The History of SQL Standards | LearnSQL.com
    Dec 8, 2020 · SQL-92. The next revision of the standard was SQL-92 – and it was a ... Part 3: SQL/CLI (Call Level Interface) (514 pages) defined an ...
  9. [9]
    [PDF] database language - SQL - NIST Technical Series Publications
    This standard was developed by the Technical Committee on Database, X3H2, under project 363D authorized by the Accredited National Standards Committee on ...Missing: timeline | Show results with:timeline<|control11|><|separator|>
  10. [10]
    SQL: The Standard and the Language
    SQL is a language designed especially for access to relational database systems; it is arguably the most significant relational database language in existence.<|control11|><|separator|>
  11. [11]
    SQL CASE works in practically all SQL-Databases - Modern SQL
    The case expression was introduced with intermediate SQL-92. SQL:1999 incorporated case as feature F261 into Core SQL so that it became mandatory. Nowadays ...
  12. [12]
    [PDF] Chapter 6: Integrity and Security Domain Constraints
    Domain Constraints (Cont.) ! The check clause in SQL-92 permits domains to be restricted: ... Null values in foreign key attributes complicate SQL referential.
  13. [13]
    New standard for stored procedures in SQL | ACM SIGMOD Record
    This document will also be known as ANSI/IEC 9075-4:1996, Information Technology - Database Languages - SQL - Part 4: Persistent Stored Modules. Google Scholar.Missing: 92 | Show results with:92<|control11|><|separator|>
  14. [14]
    The Evolution of SQL: From SQL-86 to SQL-2023 - Coginiti
    Jan 18, 2024 · SQL-92's comprehensive feature set transformed it into a more powerful tool, capable of handling the complex demands of modern data environments ...Missing: goals | Show results with:goals
  15. [15]
    [PDF] CMU 15-445/645 Database Systems (Fall 2022) :: Modern SQL
    Sep 11, 2022 · SQL-92 defines string functions. → Many DBMSs also have their own unique functions. Can be used in either output and predicates:.<|separator|>
  16. [16]
    Handling null values - ADO.NET Provider for SQL Server
    Jun 25, 2024 · The ANSI SQL-92 specification states that a null must be the same for all data types, so that all nulls are handled consistently. The System. ...
  17. [17]
    SQL Standards - Ask TOM
    Apr 4, 2012 · 6 is ANSI/ISO SQL:1992 standard. 9.i is ANSI/ISO SQL 1999 standard. Do you know where I could get information on these standards?
  18. [18]
    Bad Habits to Kick: Old-style JOINs - SQLBlog.org
    Oct 8, 2009 · One reason to avoid this syntax is that the query is often less readable than when you separate the join criteria from the filter criteria.Missing: enhancements | Show results with:enhancements<|control11|><|separator|>
  19. [19]
    Outer Joining With ANSI SQL-89 and SQL-92
    Jul 12, 2025 · Outer Joining With ANSI SQL-89 and SQL-92 · 1) Create table DEPT and EMP · 2) ANSI SQL-89 Join · 3) ANSI SQL-92 Cross Join · 4) ANSI SQL-92 Inner ...Missing: expand beyond
  20. [20]
    Why isn't SQL ANSI-92 standard better adopted over ANSI-89?
    Dec 2, 2008 · One primary advantage of the SQL-92 join notation is that there is a standard and relatively sane way of writing LEFT OUTER JOIN and variants.Should I use != or <> for not equal in T-SQL? - Stack Overflowsql - SELECT from nothing? - Stack OverflowMore results from stackoverflow.comMissing: IBM | Show results with:IBM
  21. [21]
    [PDF] Validated products list, 1993 no. 2: programming languages ...
    Apr 1, 1993 · 6. NIST POSIX CONFORMANCE TESTING. 6-1. 6.1. FIPS POSIX Standard. 6-1 ... SQL language processors that have a registered test report for FIPS PUB.
  22. [22]
    B Oracle and Standard SQL
    B Oracle and Standard SQL. This appendix discusses Oracle's conformance to the SQL-92 standards established by industry standards governing bodies.
  23. [23]
    [PDF] Adaptive Server Enterprise - Sybase Infocenter
    Special requirements for SQL92 standard compliance. When you have used the set command to turn ansi_permissions on, additional permissions are required for ...
  24. [24]
    11 Server-Side Programming: PL/SQL, Java, and JavaScript
    PL/SQL is the Oracle AI Database procedural extension to SQL. PL/SQL is integrated with the database, supporting all Oracle SQL statements, functions, and data ...
  25. [25]
    26 Oracle Data Types
    The LOB datatypes for character data are CLOB and NCLOB . They can store up to 8 terabytes of character data ( CLOB ) or national character set data ( NCLOB ).Missing: vendor | Show results with:vendor
  26. [26]
    Db2 SQL - Large objects (LOBs) - IBM
    The term large object (LOB) refers to any of the following data types: CLOB, DBCLOB, or BLOB. CLOB. A character large object (CLOB) is a varying-length ...Missing: 92 | Show results with:92
  27. [27]
    Bitmap Indexes
    An index provides pointers to the rows in a table that contain a given key value. A regular index stores a list of rowids for each key corresponding to the ...Missing: 92 extensions
  28. [28]
    8 Error Handling and Diagnostics - Oracle Help Center
    You learn how to handle warnings and errors using the ANSI status variables SQLCODE and SQLSTATE, or the Oracle SQLCA (SQL Communications Area) structure. You ...Missing: vendor expansions
  29. [29]
    [PDF] Database SQL messages and codes - IBM
    This document describes SQL messages and codes for Db2 for i, including SQLCODEs, SQLSTATEs, class codes, and SQL messages. SQLSTATEs are preferred return ...
  30. [30]
    (PDF) Recursive Query Facilities in Relational Databases: A Survey
    Aug 7, 2025 · In this paper we have reviewed and compared implementations of the recursive queries defined by SQL:1999 through SQL:2008 and offered by leading ...
  31. [31]
    [PDF] SQL:1999, formerly known as SQL3
    Background. For several years now, you've been hearing and reading about an emerging standard that everybody has been calling SQL3. Intended as a major.
  32. [32]
    ISO/IEC 9075:1992/Cor 1:1994 - Information technology
    This corrigendum applies to ISO/IEC 9075:1992. New version available: ISO/IEC 9075:1992. General information. Status : Withdrawn. Publication date : 1994-11.Missing: 1993 | Show results with:1993
  33. [33]
    ISO/IEC 9075:1992/Cor 1:1996 - Information technology
    Database languages — SQLTechnical Corrigendum 1. Withdrawn (Edition 3, 1996).Missing: amendments 1993-1996
  34. [34]
    ODBC and the Standard CLI - ODBC API Reference - Microsoft Learn
    Jun 25, 2024 · A driver written to the Open Group and ISO CLI specifications will work with an ODBC 3.x application or a standards-compliant application when ...<|control11|><|separator|>
  35. [35]
    JDBC versus SQLJ
    JDBC is based on the X/Open SQL Call Level Interface and complies with the SQL92 Entry Level standard. In addition to supporting the standard JDBC API, Oracle ...
  36. [36]
    Documentation: 18: Appendix D. SQL Conformance - PostgreSQL
    The formal name of the SQL standard is ISO/IEC 9075 “Database Language SQL”. A revised version of the standard is released from time to time; the most recent ...Missing: Transitional NIST
  37. [37]
    Database languages SQL - ISO/IEC 9075-1:2023
    In stockThis document describes the conceptual framework used in other parts of the ISO/IEC 9075 series to specify the grammar of SQL and the result of processing ...Missing: history | Show results with:history
  38. [38]
    Announcing Approval of Withdrawal of Seventeen (17) Federal ...
    Feb 8, 2005 · The purpose of this notice is to announce that the Secretary of Commerce has approved the withdrawal of seventeen (17) Federal Information ...
  39. [39]
    SQL for the 21st Century: Analytic / Window Functions - GoodData
    Jul 1, 2019 · Analytic or window functions were introduced with the SQL:2003, but many casual SQL users don't know about their power.
  40. [40]
    Modern SQL: A lot has changed since SQL-92
    The SQL standard has grown five times bigger than SQL-92. In other words: relational SQL is only about 20% of modern SQL.Literate SQL · Get the SQL Standard · The 16 Parts of SQL · The FILTER clauseMissing: deprecated | Show results with:deprecated