The best way to explain XQuery is this: XQuery is to XML what SQL is to database tables.
XQuery is designed to query XML data - not just XML files, but any data that can be represented in XML form, including databases.
XQuery terminology syntax
In XQuery, there are seven types of nodes: elements, attributes, text, namespaces, processing instructions, comments, and document nodes (or root nodes).
XQuery terminology example
<?xml version="1.0" encoding="ISO-8859-1"?> <bookstore> <book> <title>Harry Potter</title> <author>J K. Rowling</author> <year>2005</year> <price>29.99</price> </book> </bookstore>
Example of nodes in the above XML document:
<bookstore> (document node) <author>J K. Rowling</author> (element node) lang="en" (attribute node)