O'Reilly logo

XQuery from the Experts: A Guide to the W3C XML Query Language by Philip Wadler, Jim Tivy, Jérôme Siméon, Michael Rys, Jonathan Robie, Michael Kay, Mary Fernández, Denise Draper, Don Chamberlin, Howard Katz - Editor

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Integrating XQuery and SQL: Querying XML Datatypes

Once the XML data is safely stored in a relational table, the easiest way to get at the data is to use SQL to query the table and retrieve the XML-typed column, as in the following example:

SELECT CustomerName, OrderForm
FROM Customers
WHERE CustomerID = 1

However, SQL per se cannot query information inside an XML datatype instance. That is where XQuery comes in. XQuery allows us to query and transform the XML data. What we need to understand now is how to integrate the two, so that we can invoke XQuery functionality from SQL, and also provide information from the relational environment to the XQuery context.

This section introduces three ways to query XML datatype instances in the context ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required