XML Europe 2004 logo

SQL/XML, XQuery, and Native XML Programming Languages

Abstract

The SQL 2003 standard contains a module called SQL/XML for querying relational data and creating XML results. The W3C has created a query language called XQuery for querying XML documents. Currently, the specifications address distinct functionality - SQL/XML operates on the borderline between SQL and XML, and XQuery lives in a purely XML world.

However, these distinctions are fading. Some vendors have extended SQL/XML to allow queries to also address data in XML. XQuery provides substantially the same query capability as SQL/XML, and some vendors are using XQuery to address XML views of relational data. Despite these trends, the two languages appeal to very different audiences - SQL/XML is very much an extension of SQL, designed for SQL programmers, and XQuery takes a purely XML view of the world. This difference also means that the languages are suited for different tasks. SQL/XML shines for queries that are essentially relational, but which need to return XML results. XQuery shines for XML processing, or for data integration across heterogeneous data sources.

This talk uses a series of concrete queries written in each language to show the advantages of each. It explains why we need both languages, discussing the ways in which the languages differ and in which they overlap. It also explores the role of SQL/XML mappings as a way of creating XML views for XQuery.

Keywords