XML

From Wikipedia for FEVERv2
Jump to navigation Jump to search

SQL/XML or XML-Related Specifications is part 14 of the Structured Query Language (SQL) specification. XML_sentence_0

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

XML_unordered_list_0

Specification XML_section_0

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

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

Further information and examples of the SQL/XML functions are provided in the external links below. XML_sentence_4

Standard compliance XML_section_1

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: XML_sentence_5

XML_table_general_0

XML_header_cell_0_0_0 Oracle 11g Release 1XML_header_cell_0_0_1 IBM DB2 9.7XML_header_cell_0_0_2 MS SQL Server 2008XML_header_cell_0_0_3 MySQL 5.1.30XML_header_cell_0_0_4 PostgreSQL 9.1XML_header_cell_0_0_5
Datatype XMLXML_header_cell_0_1_0 partial (Oracle entitles the data type 'XMLType' instead of 'XML')XML_cell_0_1_1 HighXML_cell_0_1_2 HighXML_cell_0_1_3 NoXML_cell_0_1_4 PartialXML_cell_0_1_5
SQL/XML predicatesXML_header_cell_0_2_0 HighXML_cell_0_2_1 HighXML_cell_0_2_2 PartialXML_cell_0_2_3 NoXML_cell_0_2_4 PartialXML_cell_0_2_5
SQL/XML functionsXML_header_cell_0_3_0 HighXML_cell_0_3_1 HighXML_cell_0_3_2 PartialXML_cell_0_3_3 LowXML_cell_0_3_4 HighXML_cell_0_3_5

NOTE: only Oracle, IBM DB2 and MS-SQL-Server have been augmented with XQuery. XML_sentence_6

Examples XML_section_2

The sample SQLXML query below has SQLXML type as output(tested on DB2 9.7 and Oracle 11g): XML_sentence_7

And the output: XML_sentence_8

Samples are taken from javalobby article. XML_sentence_9


Credits to the contents of this page go to the authors of the corresponding Wikipedia page: en.wikipedia.org/wiki/XML.