Tuesday, March 18, 2008

XQuery - FLWOR expressions

FLWOR stands for "For-Let-where-Orderby-return"

XQuery is to XML as what SQL is for Database. A querying language that helps to pull meaningful information from XML data.

To start with let us look at XQuery in comparision with SQL constructs

The SQL syntax is

select field1 , field2, field3
from table1, table2
where table1.keyfield= table2.keyfield
groupby field1
having field1 operator value
orderby field2


as we all know the SQL query works like this

First it picks up the selected columns from all rows in the given table(s) and then it applies the "where" filter on the rows.

The filtered rows are grouped by the given field's value. On the group, the "having" filter is applied. The filtered group is then order by the given field's data


Similarly, using the XQuery we can select the XML document element







No comments: