[xquery-talk] XQuery and databases - XQuery 2.0

Ronald Bourret rpbourret at rpbourret.com
Mon Jun 15 22:13:36 PDT 2009


To clarify:

1) SQL/XML defines an XML data type, a syntax for constructing XML 
values from relational data, and functions for executing XQuery queries 
against XML values, creating tables from XML values/sequences, etc. It's 
worth noting that XML values are the same as XQuery sequences -- that 
is, not necessarily well-formed.

2) Oracle and DB2 implement SQL/XML. SQL Server implements the XML data 
type from SQL/XML, but uses a non-standard syntax for creating XML 
values from relational data.

3) Lots of things are non-standard. As Michael mentioned, there is no 
standard way to define an index on an XML value. Also not standard are 
things like whether you can directly execute an XQuery statement or need 
to embed it in an SQL statement; how to query relational values from 
within an XQuery statement; how XML results are retrieved from a result 
set (JDBC 4.0 defines this); and so on.

4) Different databases implement the XML data type differently, and 
these implementation choices can lead to large differences in 
performance. (Performance is obviously also query- and index-dependent.)

-- Ron

David A. Lee wrote:
> Not sure about a "standard" but the top DB vendors have done this 
> already years ago
> 
> Oracle:
> http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb13gen.htm#i1027254 
> 
> 
> MS/SQL
> http://msdn.microsoft.com/en-us/library/aa286527.aspx
> 
> DB2
> http://www.ibm.com/developerworks/db2/library/techarticle/dm-0603saracco2/
> 
> But if you think SQL is incomprehensible, take a gander at what you have 
> to do with these (above) implementations to get XML out ....
> 
> Give me pure XQuery any day :)


More information about the talk mailing list