FLWOR expressions
FLWOR (pronounced flower) expressions are the most common expressions in XQuery. They are similar to select-from-where statements in SQL. The name FLWOR is an acronym, standing for the first letter of the clauses that may occur in such an expression:
- for
- for clauses associate one or more variables to XQuery expressions. Each variable iteratively is bound to one value of the corresponding expression.
- let
- let clauses bind variables to the entire result of an XQuery expression. A sequence of variable bindings created by for and let clauses of a FLWOR expression is called a tuple.
- where
- where clauses filter tuples retaining only those that satisfy a given condition;
- order by
- order by clauses sort tuples according to the given criteria;
- return
- return clauses build the result of the expression.
A FLWOR expression starts with one or more for or let clauses in any order, followed by an optional where clause, followed by an optional order by clause, followed by a required return clause.