
DB2 XQuery concepts
The following topics introduce basic XQuery concepts and describe how XQuery works with a DB2® database.
- Introduction to XQuery
XQuery is a functional programming language that was designed by the World Wide Web Consortium (W3C) to meet specific requirements for querying and modifying XML data. - Comparison of XQuery to SQL
DB2 databases support storing well-formed XML data in a column of a table and retrieving the XML data from the database by using SQL, XQuery, or a combination of SQL and XQuery. Both languages are supported as primary query languages, and both languages provide functions for invoking the other language. - Retrieving DB2 data with XQuery functions
In XQuery, a query can call one of the following functions to obtain input XML data from a DB2 database: db2-fn:sqlquery and db2-fn:xmlcolumn. - XQuery and XPath data model
XQuery expressions operate on instances of the XQuery and XPath data model (XDM) and return instances of the data model. - Serialization of the XDM
The result of an XQuery expression, which is an instance of the XDM, can be transformed into an XML representation through a process called serialization. - XML namespaces and QNames
An XML namespace is a collection of names that is identified by a namespace URI. Namespaces provide a way of qualifying names that are used for elements, attributes, data types, and functions in XQuery. A name that is qualified with a namespace prefix is a qualified name (QName). - Language conventions
XQuery language conventions are described in the following topics. - Where to find more information about XQuery
See these resources for more information about the specifications on which DB2 XQuery is based.