overview of standard query language (sql) saeideh joodaki instructor: dr.yingshu li

21
Overview of Standard Query Language (SQL) Saeideh Joodaki Instructor: Dr.Yingshu Li

Upload: karen-woods

Post on 12-Jan-2016

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Overview of Standard Query Language (SQL) Saeideh Joodaki Instructor: Dr.Yingshu Li

Overview of Standard Query Language

(SQL)

Saeideh Joodaki

Instructor: Dr.Yingshu Li

Page 2: 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.

Page 3: Overview of Standard Query Language (SQL) Saeideh Joodaki Instructor: Dr.Yingshu Li

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)

Page 4: Overview of Standard Query Language (SQL) Saeideh Joodaki Instructor: Dr.Yingshu Li

The SQL standard has gone through a number of revisions

Year Name Alias Comments

1986 SQL-86 SQL-87 First published by ANSI. Ratified by

ISO in 1987.

1989 SQL-89 Minor revision.

1992 SQL-92 SQL2 Major revision.

1999 SQL:1999 SQL3 Added object-oriented features, introduced OLAP,

2003 SQL:2003 Introduced XML-related features,…

Page 5: Overview of Standard Query Language (SQL) Saeideh Joodaki Instructor: Dr.Yingshu Li

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).

Page 6: Overview of Standard Query Language (SQL) Saeideh Joodaki Instructor: Dr.Yingshu Li

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.

Page 7: Overview of Standard Query Language (SQL) Saeideh Joodaki Instructor: Dr.Yingshu Li

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.

Page 8: Overview of Standard Query Language (SQL) Saeideh Joodaki Instructor: Dr.Yingshu Li

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.

Page 9: Overview of Standard Query Language (SQL) Saeideh Joodaki Instructor: Dr.Yingshu Li

(SQL: 1999) New Data Types

SQL:1999 has four new data types:

1. Large Object (LOB) type CHARACTER LARGE OBJECT (CLOB) BINARY LARGE OBJECT (BLOB)

2. Boolean type

3. Two new composite types: ARRAY (storing collections of values in a column) and ROW (storing structured values in single columns of the database)

4. Distinct types

Page 10: Overview of Standard Query Language (SQL) Saeideh Joodaki Instructor: Dr.Yingshu Li

(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.

Page 11: Overview of Standard Query Language (SQL) Saeideh Joodaki Instructor: Dr.Yingshu Li

(SQL: 1999) Enhanced Security

Adding role facility.

Granting privileges to the roles.

Simplifying the difficult job of managing security in a Database environment.

Page 12: Overview of Standard Query Language (SQL) Saeideh Joodaki Instructor: Dr.Yingshu Li

(SQL: 1999) Active Database

This facility is provided through a feature known as triggers.

Page 13: Overview of Standard Query Language (SQL) Saeideh Joodaki Instructor: Dr.Yingshu Li

(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.

Page 14: Overview of Standard Query Language (SQL) Saeideh Joodaki Instructor: Dr.Yingshu Li

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.

Page 15: Overview of Standard Query Language (SQL) Saeideh Joodaki Instructor: Dr.Yingshu Li

(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: 1. BIGINT

2. MULTISET

3. XML

Page 16: Overview of Standard Query Language (SQL) Saeideh Joodaki Instructor: Dr.Yingshu Li

(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.

Page 17: Overview of Standard Query Language (SQL) Saeideh Joodaki Instructor: Dr.Yingshu Li

(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.

Page 18: Overview of Standard Query Language (SQL) Saeideh Joodaki Instructor: Dr.Yingshu Li

(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 INTEGERSTART WITH 1INCREMENT BY 1MINVALUE 1MAXVALUE 10000NO CYCLE

Page 19: Overview of Standard Query Language (SQL) Saeideh Joodaki Instructor: Dr.Yingshu Li

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.

Page 20: Overview of Standard Query Language (SQL) Saeideh Joodaki Instructor: Dr.Yingshu Li

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), ACM SIGMOD Record, 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.  

Page 21: Overview of Standard Query Language (SQL) Saeideh Joodaki Instructor: Dr.Yingshu Li

Q & A