SQL / XML

from Wikipedia, the free encyclopedia

SQL / XML specifies SQL-based extensions for using XML in conjunction with SQL . The new data type XML as well as various routines, functions as well as XML-to-SQL and SQL-to-XML mapping are introduced to support the manipulation and storage of XML in an SQL database .

SQL / XML is defined in Part 14 XML-Related Specifications (SQL / XML) of the ISO / IEC 9075 standard of the SQL database language . The standard is not freely available, but there is a ZIP archive with a draft from 2008.

description

The SQL / XML specification contains functions to construct XML data. These functions allow the user to construct new elements or attributes with values ​​from relational tables. Other functions such as XMLCONCAT or XMLAGG can be used to merge small XML fragments into larger ones. The list of available construction functions is:

  • XMLELEMENT
  • XMLATTRIBUTES
  • XMLFOREST
  • XMLCONCAT
  • XMLNAMESPACES
  • XMLCOMMENT
  • XMLPI
  • XMLDOCUMENT
  • XMLAGG
  • Etc.

SQL / XML also defines functions that allow the user to use XQuery expressions in SQL statements. These functions are:

  • XMLQUERY
  • XMLTABLE

While XMLQUERY returns values ​​of type XML, the XMLTABLE function can use XML data as input and produce a relational table as output. Properties of XML data can be expressed, for example, with the XMLEXISTS predicate, typically in the WHERE clause of an SQL statement.

Standard conformity

The evaluation of the SQL / XML : 2006 standard conformity of Oracle 11g Release 1, MS SQL Server 2008 and MySQL 5.1.30 from Wagner is based on the aforementioned draft of the ISO standard . The result of this evaluation is shown in the following list:

Oracle 11g Release 1 MS SQL Server 2008 MySQL 5.1.30
Basic data type XML partially (Oracle refers to the data type as 'XMLType' instead of 'XML') height no
SQL / XML predicates height partially no
SQL / XML functions height partially low

Due to the barely noteworthy changes in SQL / XML: 2008 compared to SQL / XML: 2006, the above list is still valid.

literature

Web links

Individual evidence

  1. Zip archive with a SQL / XML draft version from 2008
  2. ^ Michael Wagner: SQL / XML: 2006 - Evaluation of the standard conformity of selected database systems 1st edition, Diplomica Verlag, ISBN 3-8366-9609-6