You are on page 1of 55

c 

 
 








Agenda

‡ Working Group changes


‡ ISO/IEC 9075
‡ ISO/IEC 20606
‡ Recap of recent changes
‡ Sketch of planned changes

 

Working Group changes

‡ 3 ex-WG5 subprojects absorbed


± 20606-1 Authorization and Audit
± 20606-2 Distribution Schema
± 20606-3 Encompassing Transaction
‡ Effect on WG3 internal structure

 

ISO/IEC 9075
‡ Multi-part standard
± Part 1: SQL/Framework
± Part 2: SQL/Foundation
± Part 3: SQL/CLI
± Part 4: SQL/PSM
± Part 9: SQL/MED
± Part 10: SQL/OLB
± Part 11: SQL/Schemata
± Part 13: SQL/JRT
± Part 14: SQL/XML

 

Part 1: SQL/Framework

‡ Common definitions & concepts


‡ Structure of multi-part standard
‡ Basic conformance structure & statement
‡ About 85 pages

 

Part 2: SQL/Foundation

‡ The ³core´ of the standard


‡ Includes:
± Traditional SQL
± Object-oriented SQL
± Module Language
± Host language bindings (except Java)
± Dynamic SQL
± Direct SQL
‡ Excludes:
± Information Schema & Definition Schema (in Part 11)
‡ About 1300 pages
 

Part 3: SQL/CLI

‡ Call-Level Interface
‡ Best-known implementation: ODBC
‡ About 400 pages

 

Part 4: SQL/PSM

‡ Persistent Stored Modules


‡ PSM-96 specified:
± functions & procedures
± SQL-server modules
± computational completeness
‡ In PSM:1999, functions & procedures moved to
Foundation (same in 200
‡ Analogous to PL/SQL, Transact-SQL, 
‡ About 170 pages

 

Part 9: SQL/MED

‡ Management of External Data


‡ Foreign Servers, Foreign-Data Wrappers,
Foreign Tables
‡ SQL-aware u non-SQL-aware
‡ Datalinks
‡ Merge with 20606-2 Distribution Schema
‡ About 500 pages

 

Part 10: SQL/OLB

‡ Object Language Bindings


‡ Embedded SQL in Java
‡ SQLJ Part 0
‡ About 360 pages

 

Part 11: SQL/Schemata

‡ Information Schema
‡ Definition Schema
‡ About 300 pages

 

Part 13: SQL/JRT

‡ Java Routines and Types


‡ Java routines stored in an SQL database, and
invoked from SQL statements
‡ Java classes used as data types of SQL
columns
‡ About 200 pages

 

Part 14: SQL/XML

‡ Under construction
‡ Using SQL and XML together
‡ About 150 pages, but still growing

 

ISO/IEC 20206

‡ 20606-1 Authorization and Audit


‡ 20606-3 Encompassing Transaction

 

Project 20206 ±1
Authorization and Audit
‡  ! "#
$  
!%!

$ %%
&
$ '
"(
 !)
$ '
"
"! 
!&!)
$ *
 !!

‡ No Working Draft available


‡ CD expected 2002-06-01
‡ John Hadjioannou listed as Editor but not present

 

Project 20206 ±3
Encompassing Transaction
‡ (
%+!,
&'
%!
-
 
‡ "j !
"%
± 9075-6 4 %!&!.!
/ 0 1'
%!
2
‡ 3  &&
,!
"4!

‡ No Working Draft available


‡ CD expected 2002-06-01
‡ Bob Sunday listed as Editor but has withdrawn

 

Recap of recent changes:


ISO/IEC 9075 SQL:200
‡ Since 1999 we have already added:
± Part 9 SQL/MED
± Part 10 SQL/OLB
± Part 13 SQL/JRT
± Addendum 1 SQL/OLAP
‡ SQL:2003 will be the 4th generation
± 1987, 1992, 1999
‡ Consists of:
± Many error corrections
(TC stands at 376 pages and growing)
± A few new features
± Part 14 SQL/XML
 

New Features

‡ Data types
‡ Predicates
‡ Semantics
‡ Security
‡ Active Database

 

New Data Types

‡ BIGINT
‡ MULTISET

 

New Data Types ² BIGINT

‡ Exact numeric, scale 0


‡ Precision of BIGINT à precision of INTEGER
‡ Must have same radix as SMALLINT and
INTEGER

 

New Data Types ² MULTISET

‡ Varying-length, unordered collections of element


having specified type
‡ Ô  
 
‡ Ô   
  Ô 

 
‡ No (specified) maximum cardinality
‡ SQL:2003 collection types include:
± MULTISET
± ARRAY

 

New Data Types ² MULTISET

‡  
 
± Empty multiset with integer element type („  null!)
‡  
  
± Integer multiset with first few primes
‡  
  ÔÔ 


 Ô  
± Integer multiset populated from values in column of table

 

New Data Types ² MULTISET

‡ Ô u 
± Type of u  must be multiset
± Returns number of elements in u 
‡ u 
± Type of u  must be multiset
± Returns u  with duplicate elements removed
‡ 
u 
± Type of u  must be multiset
± Cardinality of u  must be 1
± Returns the single element in u 

 

New Data Types ² MULTISET


‡  u   !!"#$%&
± Type of u  must be multiset
± ³Un-nests´ u  and turns the elements
into rows of a virtual table
ë  
   '


2
3
5
7
 

New Data Types ² MULTISET


‡ u 
 (&) *
+,$#)-.-&!u 
ë (&) * ²   or /Ô' or  Ô
ë +,$#)-.-&! ²  or  Ô
‡ Ô 0

  Ô Ô 0

)10
 Ô  0 
‡ Close analogs to ordinary set operators
 , /Ô', and  Ô
‡ However,  is the default +,$#)-.-&!

 

New Data Types ² MULTISET


‡ New aggregates:
ë Ô Ô ² Transform the values in a group into a multiset
ë    ² Form a à„ „ of the multisets in a group ²
number of duplicates of a given value in the result is the
sum of the number of duplicates in the multisets in the rows
of the group
ë  Ô  ² Form an „  „ of the multisets in
a group ² number of duplicates of a given value in the
result is the minimum of the number of duplicates in the
multisets in the rows of the group

 

New Predicates
‡ 
2
± If character string argument is in Unicode Normalization Form
C (NFC), returns à
‡


± If first argument is a member of multiset in second argument,
returns à
‡ 
 
± If first argument is a submultiset of second argument, returns
à
‡ 
± If argument is a set (no duplicate values), returns à

 

NORMALIZED Predicate

‡ ()!-#345$0,& 6 7


2
‡ Character repertoire of ()!-#345$0,& must
be UCS
‡ r„ à , but does not force, normalization
to NFC

 

MEMBER Predicate
‡ 5$0,&6 7

 6 7
%,0)-(&)
‡ %,0)-(&) must be a multiset
‡ Type of 5$0,&    to element type of
%,0)-(&)
‡ If %,0)-(&) is empty, returns ! 
‡ If 5$0,& is equal to some element of %,0)-(&),
returns à
‡ Else, if some element of %,0)-(&) is null, returns
à„„ „

 

SUBMULTISET Predicate
‡ %,0)-(&)6 7 
 
6 7%,0)-(&)
‡ Both %,0)-(&) and %,0)-(&) must be
multisets«
‡ «and their element types must be comparable
‡ If the cardinalities of %,0)-(&) and
%,0)-(&) are equal and if every value in
%,0)-(&) has a corresponding value in
%,0)-(&) , then returns à

 

SET Predicate

‡ %,0)-(&) 6 7 


‡ %,0)-(&) must be a multiset
‡ If there are no duplicate values in %,0)-(&),
returns à
‡ Maximum of 1 null value in a set

 

New Semantics

‡
  statement
‡ OLAP:  
'
‡ Generated columns
‡ Identity columns and sequence generators

 

New Semantics ² MERGE

‡ Ú  

 


 
 

  


 

 
 





‡ Ú   

 


    
 

  


 

 
 


 







 

New Semantics ² MERGE


‡
  )$10&"#$%&6  !!&0$)- #7
)$10&"!&.&!&#&
(&$!8" #9-)- #

Ô  0:5$0,&
‡
  )$10&"#$%&6  !!&0$)- #7
)$10&"!&.&!&#&
(&$!8" #9-)- #
 
Ô
  6 0"0-()7
  5$0"0-()
‡ Both
Ô and  
Ô clauses permitted
once each, in either order

 

TABLESAMPLE

‡ New feature in the OLAP capability


‡ Permits evaluation of aggregates on  
derived from database data
‡ Permits faster debugging when database is huge
‡ Two forms of sampling:    and
 

 

TABLESAMPLE

‡  
'%&)8 9*&!&#)$3&
6!&*&$)$10&7
‡ %&)8 9 is either    or  

± Bernoulli: Sample table contains approximately *&!&#)$3& %


of the rows of the original table; the probability of a given row of
the original table appearing in the sample table is *&!&#)$3&
%, independently of every other row
± System: Sample table contains approximately *&!&#)$3& %
of the rows of the original table; the probability of a given row of
the original table appearing in the sample table is *&!&#)$3&
%
‡ !&*&$)$10& acts as a random number seed for
sampling
 

Generated Columns

‡ Ordinary columns of base tables:  


 à„
‡ Generated column: value computed from values of zero
or more base columns in same row
‡ Ô 
'  

'4 
 Ô
 
  Ô
 
 4Ô
'  
  ;  
 4Ô <  
Ô 4  


 

Identity columns &


Sequence generators
‡ Identity column: Invented as mechanism to
allow automatic population of table keys
‡ Sequence generator: Invented to allow
generation of ³next´ value in a sequence
‡ Together, they allow generation of keys for
unique columns (or combinations of columns)
when required
‡ Application chooses: select value for identity
column or let sequence generator make choice

 

Sequence generators

‡ Sequence generators
± Data type (exact numeric with scale zero)
± Starting value
± Increment (positive: ascending, negative:
descending)
± Minimum and maximum values
± Cycle option
± External (explicit schema object) or internal (part of
another schema object, such a column)

 

External sequence generators

‡ Ô  = Ô(&+#$%& )>*&


 5$0,&
Ô 
5$0,&

/ 5$0,&
ÔÔ
6
44

5 
%

!


‡ Variations:
ë  ÔÔ
ë  
/ ,
 ,  
 
± Order of clauses can vary

 

Sequence generators

‡ Every sequence generator has a ³current base


value´ ² initially set to the start value
‡ Generate next value of a sequence generator:
/  (&+#$%&
‡ Returns current base value + ÿ U increment for
some ÿ à 0
± If computed value >
/  (or <
 )
and  ÔÔ, then raise an exception
± Otherwise, reset to
  (or
/ ) and
compute new value for some ÿ

 

Sequence generators

‡    Ô Ô  


  
/  (&+3&#
‡ Ô%>*! /  (&+3&#
‡ ?:?;/  (&+3&#

 

Sequence generators

‡   = Ô(&+#$%&
ë   #&@1$(& ² resets start of
computation
± Common sequence generator options ² change
start value, maximum or minimum, increment, cycle
option
‡  ' = Ô(&+#$%&9! * *)- #

 

Identity columns &


Sequence generators
‡ Base tables may optionally have a single „

 à„
‡ Data type: exact numeric, scale 0 ² ,

‡ Associated with „„ sequence generator
± Start value
± Minimum and/or maximum value
± Increment value
± Cycle option
 

Identity columns &


Sequence generators
‡   or  
 
ë  ² Not allowed to ' column;
   requires    
 
ë   ² Allowed to    or '
column; if column not specified on   , then
value automatically generated

 

Identity columns &


Sequence generators
‡ Ô &%*0 >&&(

'4
   
 
Ô 


 
 
/ 
 ÔÔ
 Ô
 AAA

 

New part ± SQL/XML

‡ Out for FCD ballot


‡ Known not to be complete
‡ Current contents comprise infrastructure ²
mappings of«
± SQL identifiers to & from XML QNames
± SQL types & values onto XML schema types &
values
± SQL tables onto XML schema types
± Publishing functions (SQL data expressed as XML)
± New built-in type for SQL: XML
 

To be added:
Inserting XML into an SQL database
‡ Transform character string containing XML text into an
XML value
‡    &%*0 >&&(&%*B%0
  /
' CD&%*-9:EFE
D#$%&,!#&>$00&GDH#$%&
D8-!&9$)&FFI"" DH8-!&9$)&
D9&*) &,!-)>DH9&*)DH&%*C
 ' 'Ô
‡ ÿ
 „
   yet (still working out issues)

 

To be added:
Inserting XML into an SQL database

‡ XMLPARSE does not u 


‡ But it does:
± Syntax check all in-line DTDs
± Process entity references defined in such DTDs
± Apply default values defined in such DTDs
‡ Whitespace handling not finalized:
± STRIP and
± PRESERVE are possible choices

 

To be added:
Validating XML in an SQL context

‡ Validate an XML value against an XML schema


(possibly a DTD)
‡    &%*0 >&&(&%*B%0
  /
/
' CD&%*
-9:EFED#$%&,!#&>
$00&GDH#$%&D8-!&9$)&FFI"" 
DH8-!&9$)&D9&*) &,!-)>DH9&*)
DH&%*C  ' 'Ô
‡ ÿ
 „
   yet (still working out issues)

 

To be added:
Validating XML in an SQL context

‡ Many remaining problems:


± How to reference DTDs and schemas
± Security problems of referencing arbitrary DTDs and
schemas
± Namespace considerations
‡ B(-J(8&%$ $)- # and
B(-J# $%& *$& 8&%$ $)- # might
identify schemas outside the database ² a
solution might involve caching schemas inside
the database

 

To be added:
Retrieving XML from an SQL database

‡ Transform an XML value into a character string


containing XML text
‡ Ô/
  2&A&%*B%0
 J8 ()5$!

&%* &
 AAA
‡ ÿ
 „
   yet (still working out issues)

 

To be added:
Retrieving XML from an SQL database
‡ Numerous problems not yet resolved:
± Precise SQL type of the function result
(CHARACTER, CHARACTER VARYING,
CHARACTER LARGE OBJECT)
± 6à character encoding (UTF8, UTF16, other) ²
and SQL¶s specified character set
± ! character encoding in prologue
± DTD or schema inference? Creation?

 

Summary
‡ ISO/IEC 9075
± Consolidation of changes since 1999
± Correction of errors
± New Part (SQL/XML)

‡ ISO/IEC 20206
± Area of concern
± Looking for:
± National Body participation
± Editor(s)

 

Questions?