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運算式中用於獲取序列中項的位置。

上一篇: XQuery序列 下一篇: XQuery字串函數