SQL: Standards and Flavors A presentation for CS157B by David Wortham
SQL Definition SQL: Structured Query Language SQL: Structured Query Language Invented in 1974 by Donald Chamberlin and Raymond Boyce for IBM Invented in 1974 by Donald Chamberlin and Raymond Boyce for IBM Used for creation and modification of Relational DataBase data and schema Used for creation and modification of Relational DataBase data and schema Multiple Standard Revisions and Multiple Flavors (Implementations) exist Multiple Standard Revisions and Multiple Flavors (Implementations) exist
Standard Revisions Differences: Revisions successively introduced additional features Revisions successively introduced additional features Revisions are mostly Backwards- Compatible with older standards Revisions are mostly Backwards- Compatible with older standardsSimilarities: Ratified by Standards Organizations Ratified by Standards Organizations Incompletely implemented by vendors Incompletely implemented by vendors
Standard Revisions and Dates of Standardization SEQUEL/Original SQL SEQUEL/Original SQL SQL-86 (ANSI/ISO) SQL-86 (ANSI/ISO) SQL SQL SQL: SQL: SQL: SQL: SQL: SQL:
Standards Revisions: SEQUEL Original definition of SQL Original definition of SQL Mostly defined data manipulation and schema definition controls Mostly defined data manipulation and schema definition controls
Standards Revisions: SQL-86 Ratification and acceptance of a formal SQL standard by ANSI and ISO Ratification and acceptance of a formal SQL standard by ANSI and ISO
Standards Revisions - SQL:92 New datatypes: DATE, TIME, TIMESTAMP, INTERVAL, VARCHAR New datatypes: DATE, TIME, TIMESTAMP, INTERVAL, VARCHAR New scalar operations: string concatenation, date and time mathematics New scalar operations: string concatenation, date and time mathematics New set operations: UNION JOIN, NATURAL JOIN New set operations: UNION JOIN, NATURAL JOIN Schema changes via ALTER and DROP Schema changes via ALTER and DROP Among others… Among others…
Standards Revisions - SQL:99 Adds User Defined Types (UDTs) to SQL Adds User Defined Types (UDTs) to SQL Among others… Among others…
Standards Revisions - SQL:2003 XML-related features XML-related features MERGE statement defined MERGE statement defined SEQUENCE generation SEQUENCE generation Among others… Among others…
Standards Revisions – SQL:2006 Increased support for XML Increased support for XML Support for XQuery, an XML-SQL interface standard Support for XQuery, an XML-SQL interface standard
Flavors of SQL Most implementations do not implement the entire standard Most implementations do not implement the entire standard Schemas and Stored Procedures for different flavors are rarely portable Schemas and Stored Procedures for different flavors are rarely portable Timestamp data types are usually proprietary Timestamp data types are usually proprietary Common Flavors: Oracle Oracle MySQL MySQL SQLite SQLite Postgres Postgres MSQL (Microsoft) MSQL (Microsoft) Microsoft Access Microsoft Access
Flavors: Stored Procedure Support Common Procedural Languages (PLs): ANSI/ISO Standard: SQL/PSM ANSI/ISO Standard: SQL/PSM IBM: SQL PL IBM: SQL PL Microsoft/Sybase: T-SQL Microsoft/Sybase: T-SQL MySQL: MySQL MySQL: MySQL Oracle: PL/SQL Oracle: PL/SQL PostgreSQL: PL/pgSQL PostgreSQL: PL/pgSQL
Flavors: MySQL 5.x MySQL 5.x Implements most of SQL:99 standard including: Stored Procedures Stored Procedures Triggers Triggers XA transactions XA transactions
Flavors: Oracle 10g Release 2 Implements much of SQL:2003 Implements much of SQL:2003 Complete Listing of CORE feature support: Complete Listing of CORE feature support:
Flavors: SQLite 3.x SQLite 3.x Implements most of SQL:92 standard except: FOREIGN KEY constraints FOREIGN KEY constraints Complete trigger support Complete trigger support Complete ALTER TABLE support Complete ALTER TABLE support Nested transactions Nested transactions RIGHT and FULL OUTER JOIN RIGHT and FULL OUTER JOIN Writing to VIEWs Writing to VIEWs GRANT and REVOKE GRANT and REVOKE
Flavors: PostgreSQL 8.4 Implements most of SQL:2003 except: Implements most of SQL:2003 except: MERGE statement MERGE statement Assertions, Subqueries in CHECK Assertions, Subqueries in CHECK Some flagging features Some flagging features Many array features Many array features BLOB data type BLOB data type Comprehensive list: Comprehensive list:
Vendor MarketShare 1 Source: JoinVision E-Services GmbH, July 2006
Vendor MarketShare 2 "Relational Databases Rule the Roost”, SD Times in July 2004
References MySQL :: MarketShare MySQL :: MarketShare SQL: SQL: PostgreSQL supported and unsupported standard features PostgreSQL supported and unsupported standard features SQL Features That SQLite Does Not Implement SQL Features That SQLite Does Not Implement