MEDIAN Function | Teradata Vantage - MEDIAN - Analytics Database - Teradata Vantage

Time Series Tables and Operations

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-10-30
dita:mapPath
tuc1628112453431.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
sfz1493079039055
lifecycle
latest
Product Category
Teradata Vantageā„¢

Returns the median of all values in each group. MEDIAN returns the average of the two middle values if the value_expression contains an even number of values. It is a single-threaded function.

To invoke the time series version of this function, use the GROUP BY TIME clause. For more information, see GROUP BY TIME Clause.

Return Values

This function returns the REAL data type.

Nulls are not included in the result computation.

Usage Notes

The ALL keyword includes all non-null value_expressions, including duplicates in the computation. The DISTINCT keyword excludes duplicates specified by value_expression from the computation.
  • MEDIAN is valid only for numeric data.
  • DISTINCT is only valid with MEDIAN when using the time series version of MEDIAN. MEDIAN DISTINCT queries return an error if not associated with a GROUP BY TIME clause.