Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Introduction to XQuery

May 28, 2021 XQuery

Table of contents

Introduction to XQuery

This section will introduce you to XQuery.

The best way to explain XQuery is to say that XQuery's relationship to XML is equivalent to SQL's relationship to a database table.

XQuery is designed to query XML data - not just XML files, but also any data that can be rendered in XML patterns, including databases.

The basics you should have:

Before you move on, you need to have a basic understanding of the following:

  • XML / XML namespace
  • Xpath

If you would like to learn about these projects first, please visit these tutorials on our home page.

What is XQuery?

Introduction to XQuery
  • XQuery is the language used for XML data queries
  • XQuery is similar to SQL for databases
  • XQuery is built on an XPath expression
  • XQuery is supported by all major database engines (IBM, Oracle, Microsoft, etc.)
  • XQuery is the W3C standard

XQuery is related to XML queries

XQuery is the language used to find and extract elements and properties from XML documents.

Here's an example of XQuery solving a real problem:

"Choose all CD records cd_catalog.xml less than $10 from the set of CDs stored in an XML document named "Library."

XQuery and XPath

XQuery 1.0 and XPath 2.0 share the same data model and support the same functions and operators. If you've already learned XPath, learning XQuery won't be a problem.

You can read more about XPath in our XPath Tutorials.

XQuery - App example

XQuery can be used to:

  • Extract information for use in network services
  • Generate a summary report
  • Convert XML data to XHTML
  • Search for web documents for relevant information

XQuery is a W3C recommendation

XQuery is compatible with a variety of W3C standards, such as XML, Namespaces, XSLT, XPath, and XML Schema.

XQuery 1.0 was established as the W3C recommended standard on January 23, 2007.

For more information about the XQuery event at W3C, read our W3C tutorial.

In the next section, we'll begin to learn about the knowledge points associated with XQuery.