210 likes | 363 Views
Overview of Standard Query Language (SQL) . Saeideh Joodaki Instructor: Dr.Yingshu Li. Outline. Standardization. Brief review of SQL 86, SQL 89, SQL 92. Evolution to SQL: 1999. Latest version; SQL: 2003. Database Standard Organization. ISO (International Standard Organization)
E N D
Overview of Standard Query Language (SQL) Saeideh Joodaki Instructor: Dr.Yingshu Li
Outline • Standardization. • Brief review of SQL 86, SQL 89, SQL 92. • Evolution to SQL: 1999. • Latest version; SQL: 2003.
Database Standard Organization • ISO (International Standard Organization) • JTC1 (Joint Technical Committee 1) • Subcommittee SC32 WG3 (Database Languages) WG4 (SQL/MM) • ANSI (American National Standards Institute) • NCITS (National Committee for Information Technology Standardization) • H2 (X3H2)
SQL-86 • The first generation of SQL. • Implemented by IBM. • Defined 3 ways to process DML. Direct processing, Module language, Embedded SQL • Bindings to Cobol, Fortan, Pascal, PL/1. • Criticized for the lack of common features and orthogonality (independence).
SQL-89 • Superset of SQL-86. • Bindings to two more languages, C and ADA. • Defined DDL in the separate “schema definition language”. (CREATE TABLE, CREATE VIEW, and GRANT PRIVILEGES, with No drop, Alter, or revoke). • Introduced default, Unique, and Not Null values. • Defined Primary keys, check constraint, and Referential integrity.
SQL-92 • Superset of SQL-89. • Designed to be a standard for relational database management systems (RDBMSs). • Added significant new features and capabilities to the specifications, such as: • Support for additional data types (DATE, TIME, TIMESTAMP, INTERVAL, BIT string, variable-length character and bit strings, and NATIONAL CHARACTER strings), • Additional set operators (for example, union join, natural join, set difference, and set intersection), • Capability for domain definitions in the schema.
SQL:1999 • Intended as a major enhancement. • Characterized as "object-oriented SQL“. • In addition to the object oriented extensions, there are some other new features like; Triggers, Stored procedures and user-defined functions, Recursive queries, OLAP, SQL procedural constructs, Expressions in ORDER BY Savepoints, Update through unions and joins. • The new features are divided into five category: new data types, new predicates, enhanced semantics, additional security, and active database.
(SQL: 1999) New Data Types • SQL:1999 has four new data types: • Large Object (LOB) type • CHARACTER LARGE OBJECT (CLOB) • BINARY LARGE OBJECT (BLOB) • Boolean type • Two new composite types: ARRAY (storing collections of values in a column) and ROW (storing structured values in single columns of the database) • Distinct types
(SQL: 1999) New Predicates • Using “SIMILAR” besides “LIKE”: gives programs UNIX-like regular expressions. WHERE NAME SIMILAR TO '(SQL-(86|89|92|99)) I (SQL(I|2|3))‘ (which would match the various names given to the SQL standard over the years.) • DISTINCT predicate.
(SQL: 1999) Enhanced Security • Adding role facility. • Granting privileges to the roles. • Simplifying the difficult job of managing security in a Database environment.
(SQL: 1999) Active Database • This facility is provided through a feature known as triggers.
(SQL: 1999) Object Orientation • The structured user-defined types. • They may be defined to have one or more attributes. • All aspects of their behaviors are provided through methods, functions, and procedures. • Their attributes are encapsulated through the use of system-generated observer. • They may participate in type hierarchies.
SQL: 2003 • Makes revisions to all parts of SQL: 1999. • Adds a brand new part: SQL/XML (XML-Related Specifications). • New features are categorized as: • New data types, • Enhancements to SQL-invoked routines, • Extensions to CREATE TABLE statement, • A new MERGE statement, • A new schema object - the sequence generator, • Two new sorts of columns – identity columns and generated columns.
(SQL: 2003) New Data Types • Retains all data types that existed in SQL: 1999 with the exception of the BIT and BIT VARYING data types. • Introduces three new data types: • BIGINT • MULTISET • XML
(SQL: 2003) Table Functions • New in SQL: 2003. • SQL-invoked function that returns a “table”. • Table functions give increased functionality by allowing sets of tuples from any external data sources to be invoked (as if they were a table). • Table function execution can be parallelized giving improved speed and scalability.
(SQL: 2003) MERGE statement • In addition to the three statements for updating the database, (INSERT, UPDATE, and DELETE) SQL: 2003 adds MERGE. • Combining INSERT and UPDATE into MERGE. • Transferring a set of rows from a “transaction table” to a “master table” maintained by the database.
(SQL: 2003) Sequence Generators • New kind of database object with an associated time-varying exact numeric value. • Mechanism for generating unique values automatically. • User can define minimum value, a maximum value, a start value, an increment, and a cycle option for the sequence generator they are creating. CREATE SEQUENCE PARTSEQ AS INTEGER START WITH 1 INCREMENT BY 1 MINVALUE 1 MAXVALUE 10000 NO CYCLE
Conclusion • Reviewed some important developments of SQL. • Specifically, described only some important features of SQL: 1999 and SQL: 2003. • Observed that SQL: 1999 has been a major development compare to previous versions. • SQL: 2003 is modified-enhanced version of SQL: 1999 and it is popularly believed to be largely a “bug-fix release” of the SQL standard.
References • Andrew Eisenberg, Jim Melton, SQL/XML is Making Good Progress, ACM SIGMOD REC., Volume 31, Issue 2, No. 8, June 2002, Publisher: ACM Press. • Jim Melton, Andrew Eisenberg, SQL Multimedia and Application Packages (SQL/MM), ACMSIGMODRecord, Volume 30, Issue 4, No. 6, December 2001, Publisher: ACM Press. • Andrew Eisenberg, Jim Melton, Krishna Kulkarni, Jan-Eike Michels, Fred Zemke, SQL:2003 Has Been Published, ACM SIGMOD Record, Volume 33, Issue 1, No.8, March 2004 , Publisher: ACM Press. • Andrew Eisenberg, Jim Melton, Advancements in SQL/XML, ACM SIGMOD Record, September 2004, Volume 33, Issue 3, No. 8, Publisher: ACM Press. • Andrew Eisenberg, Jim Melton, SQL: 1999, formerly known as SQL3, ACM SIGMOD record, March 1999, Volume 28 , Issue 1, No. 8, Publisher: ACM Press.