# XQuery - Sequence Functions

The following table lists the commonly used sequence functions provided by XQuery.

Sr.No | Name & Description |
---|---|

1 |
Counts the items in a sequence. |

2 |
Returns the sum of the items in a sequence. |

3 |
Returns the average of the items in a sequence. |

4 |
Returns the minimum valued item in a sequence. |

5 |
Returns the maximum valued item in a sequence. |

6 | distinct-values($seq as item()*) Returns select distinct items from a sequence. |

7 | subsequence($seq as item()*, $startingLoc as xs:double, $length as xs:double) Returns a subset of provided sequence. |

8 | insert-before($seq as item()*, $position as xs:integer, $inserts as item()*) Inserts an item in a sequence. |

9 | remove($seq as item()*, $position as xs:integer) Removes an item from a sequence. |

10 |
Returns the reversed sequence. |

11 | index-of($seq as anyAtomicType()*, $target as anyAtomicType()) Returns indexes as integers to indicate availability of an item within a sequence. |

12 |
Returns the last element of a sequence when used in predicate expression. |

13 |
Used in FLOWR expressions to get the position of an item in a sequence. |