Changes

Jump to navigation Jump to search
46 bytes added ,  13:12, 13 January 2011
no edit summary
==Group By==
FLWOR expressions have been extended by to include the [http://www.w3.org/TR/xquery-30/#id-group-by group by] clause, which is well-established among relational database systems. Group <code>group by clauses </code> can be used to apply value -based paritioning partitioning to query results:
'''Example:'''
"standard"
else if($ic >= 100000) then
"preferedpreferred"
else
"na"
</pre>
Is This query is a rewrite of [http://www.ins.cwi.nl/projects/xmark/Assets/xmlquery.txt| Query #20] contained in the [http://www.ins.cwi.nl/projects/xmark|XMARK XMark Benchmark Suite] to use ''<code>group by''</code>.
The query partitions the customers based on their income.
</pre>
In contrast to the relational GROUP BY statement, the XQuery counterpart
concatenates the values of all non-grouping variables that belong to a specific group.
In the context of our example, all nodes in <code>//people/person</code> that belong to the <code>"preferred"</code> partition are concatenated in <code class="brush:xquery">$ppl</code> after grouping has finished.
<pre class="brush:xquery">
...
return element {$income} {count($ppl)}
</pre>
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu