XQuery Sequence Functions

Let's see the list of commonly used sequence functions provided by XQuery:

IndexNameDescription
1)count($seq as item()*)It is used to count the items in a sequence.
2)sum($seq as item()*)It is used to return the sum of the items in a sequence.
3)avg($seq as item()*)It is used to return the average of the items in a sequence.
4)min($seq as item()*)It is used to return the minimum valued item in a sequence.
5)max($seq as item()*)It is used to return the maximum valued item in a sequence.
6)distinct-values($seq as item()*)It returns select distinct items from a sequence.
7)subsequence($seq as item()*, $startingloc as xs:double, $length as xs:double)It is used to return a subset of provided sequence.
8)insert-before($seq as item()*, $position as xs:integer, $inserts as item()*)It is used to insert an item in a sequence.
9)remove($seq as item()*, $position as xs:integer)It is used to remove an item from a sequence.
10)reverse($seq as item()*)It is used to return the reversed sequence.
11)index-of($seq as anyatomictype()*, $target as anyatomictype())It returns indexes as integers to indicate availability of an item within a sequence.
12)last()It returns the last element of a sequence when used in predicate expression.
13)position()It is used in FLOWR expressions to get the position of an item in a sequence.




Latest Courses