SQL/XML

Uses your system voice; voice and rate in settings.

Snapshot

≈ 2 min read

Names in other languages

No names in other languages are held for this entry yet.

Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.

SQL/XML or XML-Related Specifications is part 14 of the Structured Query Language (SQL) specification. In addition to the traditional predefined SQL data types like NUMERIC, CHAR, TIMESTAMP, ... it introduces the predefined data type XML together with constructors, several routines, functions, and XML-to-SQL data type mappings to support manipulation and storage of XML in a SQL database. * SQL:2003-14 defines the basic datatype, mappings, predicates and functions. * SQL:2006-14, SQL:2008-14 and SQL:2011-14 expands the older versions and approaches to XQuery.

SQL/XML or XML-Related Specifications is part 14 of the Structured Query Language (SQL) specification. In addition to the traditional predefined SQL data types like NUMERIC, CHAR, TIMESTAMP, ... it introduces the predefined data type XML together with constructors, several routines, functions, and XML-to-SQL data type mappings to support manipulation and storage of XML in a SQL database. SQL:2003-14 defines the basic datatype, mappings, predicates and functions. SQL:2006-14, SQL:2008-14 and SQL:2011-14 expands the older versions and approaches to XQuery. ==Specification== The specification defines the data type XML , functions for working with XML, including element construction, mapping data from relational tables, combining XML fragments, and embedding XQuery expressions in SQL statements. Functions which can be embedded include XMLQUERY (which extracts XML or values from an XML field) and XMLEXISTS (which predicates whether an XQuery expression is matched). Further information and examples of the SQL/XML functions are provided in the external links below . ==Standard compliance== The result of Wagner's objective evaluation of the SQL/XML:2006 standard compliance of Oracle 11g Release 1, MS SQL Server 2008 and MySQL 5.1.30 is shown in the following table , to which the data for PostgreSQL 9.1, and IBM DB2 has been added: ==Examples== The sample SQLXML query below has SQLXML type as output(tested on DB2 9.7 and Oracle 11g): SELECT XMLELEMENT(NAMEs "PhoneBook", -- root element name XMLAGG( -- aggregation over the rows XMLELEMENT(NAME "Contact", XMLATTRIBUTES(cust.FIRST_NAME AS "Name", cust.TEL) ) ) ) FROM TMP.CUSTOMER AS cust; And the output: Samples are taken from javalobby article . ==References== ==External links== SQL/XML on PostgreSQL SQL/XML on Oracle 11g

Text derived from https://en.wikipedia.org/w/index.php?oldid=1370015248 under CC BY-SA 4.0; modifications have been made.