XQuery序列函数

下表列出了XQuery提供的常用序列函数,它们如下所示 -

序号 名称 描述
1 count($seq as item()*) 计算序列中的项目数量。
2 sum($seq as item()*) 返回序列中数据项的总和。
3 avg($seq as item()*) 返回序列中数据项的平均值。
4 min($seq as item()*) 返回序列中数据项的最小值。
5 max($seq as item()*) 返回序列中数据项的最大值。
6 distinct-values($seq as item()*) 返回序列中的选择不同数据项。
7 subsequence($seq as item()*, $startingLoc as xs:double, $length as xs:double) 返回提供序列的子集。
8 insert-before($seq as item(), $position as xs:integer, $inserts as item()) 在序列中插入数据项目。
9 remove($seq as item()*, $position as xs:integer) 从序列中删除数据项。
10 reverse($seq as item()*) 返回反转序列中数据项。
11 index-of($seq as anyAtomicType()*, $target as anyAtomicType()) 将索引作为整数返回,以指示序列中数据项的可用性。
12 last() 在谓词表达式中使用时,返回序列的最后一个元素。
13 position() 在FLOWR表达式中用于获取序列中项的位置。