XQuery - 序列函式



下表列出了 XQuery 提供的常用序列函式。

序號 名稱和描述
1

count($sequence as item()*)

計算序列中的專案。

2

sum($sequence as item()*)

返回序列中專案的總和

3

avg($sequence as item()*)

返回序列中專案的平均值。

4

min($sequence as item()*)

返回序列中值最小的專案。

5

max($sequence as item()*)

返回序列中值最大的專案。

6

distinct-values($sequence as item()*)

從序列中返回具有不同值的專案。

7

subsequence($sequence as item()*, $startingLocation as xs:double, $length as xs:double)

返回提供的序列的子集。

8

insert-before($sequence as item()*, $position as xs:integer, $inserts as item()*)

在序列中插入專案。

9

remove($sequence as item()*, $position as xs:integer)

從序列中刪除專案。

10

reverse($sequence as item()*)

返回反向序列。

11

index-of($sequence as anyAtomicType()*, $target as anyAtomicType())

將索引作為整數返回,以指示序列中專案的可用性。

12

last()

在謂詞表達式中使用時返回序列的最後一個元素。

13

position()

在 FLOWR 表示式中使用,以獲取序列中專案的序號。

廣告