My Poetry, Philosophy, Thoughts and Ideas.

11/22/2003

XQUERY

Xquery as i Understand

1. The future of software industry heavily depends upon XML.
2. Earlier all Datbases for Query retrieval was supporting SQL
3. Xquery is a mix of SQL and XML for running queries against XML tagged docs in files and databses.
4. Running SQL Query on XML documents was found not a perfect solution.
5. XML is hierarchial, and the tree structure needs to be preserved while querying.
6. Thus many queries on XML document require positional logic to determine the correct node in the tree.
7. XML query or XQuery working group involves IBM, AT&T, BEA, Bell Labs, Microsoft, DataDirect and Oracle companies.
8. They framed , a requirement specification, data model, query algebra, formal grammar and specifications of XQuery.
9. XQUERY contains conditional expressions or called FLWR
F - For
L - LET
W - WHERE
R - RETURN
10. As SQL supports joins between tables, XQUERY supports linkages between multiple documents.
11. Xquery provides sorting with ORDER BY clause and FIltering by WHERE clause
12. XQUERY like SQL provides function call and userdefined functions as well.
13. Xquery can be run on XML documents not stored in Database , but in file system
14. XQUERYX is another syntax where one can query the XML using XML tags itself
15. XQUEY example

Assume an XML document called badri.xml as follows



Assume we have to write a query , to display for each book we would require to print the title and author for a Publisher for year 2001 , the following would be a rough query

FOR $b IN Document ("http://badri.blogspot.com/badri.xml")//book
WHERE $b/publisher="PublicationName" AND $b/year="2001"
RETURN $b/titles $b/author

0 Comments:

Post a Comment

<< Home