STDDEV_POP - Teradata Database

SQL Functions, Operators, Expressions, and Predicates

Teradata Database
Release Number
English (United States)
Last Update
Product Category
Teradata® Database



Returns the population standard deviation for the non-null data points in value_expression.




Syntax element …

Specifies …


to include all non-null values specified by value_expression, including duplicates, in the computation. This is the default.


to exclude duplicates of value_expression from the computation.


a numeric literal or column expression whose population standard deviation is to be computed.

The expression cannot contain any ordered analytical or aggregate functions.

ANSI Compliance

This is ANSI SQL:2011 compliant.


The standard deviation is the second moment of a population. For a population, it is a measure of dispersion from the mean of that population.

Do not use STDDEV_POP unless the data points you are processing are the complete population.

Combination With Other Functions

STDDEV_POP can be combined with ordered analytical functions in a SELECT list, QUALIFY clause, or ORDER BY clause. For more information on ordered analytical functions, see Chapter 22: “Ordered Analytical / Window Aggregate Functions.”

STDDEV_POP cannot be combined with aggregate functions within the same SELECT list, QUALIFY clause, or ORDER BY clause.

How GROUP BY Affects Report Breaks

STDDEV_POP operates differently depending on whether there is a GROUP BY clause in the SELECT statement.


IF the query …

THEN STDDEV_POP is reported for …

specifies a GROUP BY clause

each individual group.

does not specify a GROUP BY clause

all the rows in the sample.

Measuring the Standard Deviation of a Population

If your data represents only a sample of the entire population for the variable, then use the STDDEV_SAMP function. For information, see “STDDEV_SAMP” on page 97.

As the sample size increases, the values for STDDEV_SAMP and STDDEV_POP approach the same number, but you should always use the more conservative STDDEV_SAMP calculation unless you are absolutely certain that your data constitutes the entire population for the variable.


The equation for computing STDDEV_POP is as follows:



This variable …

Represents …



When there are no non-null data points in the population, then STDDEV_POP returns NULL.

Division by zero results in NULL rather than an error.

Result Type and Attributes

The data type, format, and title for STDDEV_POP(x) are as follows.

Data type: REAL

  • If the operand is character, the format is the default format for FLOAT.
  • If the operand is numeric, date, or interval, the format is the same format as x.
  • If the operand is UDT, the format is the format for the data type to which the UDT is implicitly cast.
  • For information on the default format of data types, see “Data Type Formats and Format Phrases” in SQL Data Types and Literals.

    Support for UDTs

    By default, Teradata Database performs implicit type conversion on a UDT argument that has an implicit cast that casts between the UDT and any of the following predefined types:

  • Numeric
  • Character
  • DATE
  • Interval
  • To define an implicit cast for a UDT, use the CREATE CAST statement and specify the AS ASSIGNMENT clause. For more information on CREATE CAST, see SQL Data Definition Language.

    Implicit type conversion of UDTs for system operators and functions, including STDDEV_POP, is a Teradata extension to the ANSI SQL standard. To disable this extension, set the DisableUDTImplCastForSysFuncOp field of the DBS Control Record to TRUE. For details, see Utilities: Volume 1 (A-K).

    For more information on implicit type conversion of UDTs, see Chapter 13: “Data Type Conversions.”

    STDDEV_POP Window Function

    For the STDDEV_POP window function that performs a group, cumulative, or moving computation, see “Window Aggregate Functions” on page 984.