15.00 - SKEW - Teradata Database

Teradata Database SQL Functions, Operators, Expressions, and Predicates

Product
Teradata Database
Release Number
15.00
Content Type
Programming Reference
Publication ID
B035-1145-015K
Language
English (United States)

SKEW

Purpose  

Returns the skewness of the distribution of value_expression.

Syntax  

where:

 

Syntax element …

Specifies …

ALL

that all non-null values specified by value_expression, including duplicates, are included in the computation for the group. This is the default.

DISTINCT

that null and duplicate values specified by value_expression are eliminated from the computation for the group.

value_expression

a literal or column expression for which the skewness of the distribution of its values is to be computed.

The expression cannot contain any ordered analytical or aggregate functions.

ANSI Compliance

This is ANSI SQL:2011 compliant.

Definition

Skewness is the third moment of a distribution. It is a measure of the asymmetry of the distribution about its mean compared with the normal, Gaussian, distribution.

The normal distribution has a skewness of 0.

Positive skewness indicates a distribution having an asymmetric tail extending toward more positive values, while negative skewness indicates an asymmetric tail extending toward more negative values.

Result Type and Attributes

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

 

Data Type

Format

Title

REAL

Default format of the REAL data type

SKEW(x)

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 SKEW, 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.”

    Computation

    The equation for computing SKEW is defined as follows:

    where:

     

    This variable …

    Represents …

    x

    value_expression

    Conditions That Produce a Null Result

    The following conditions product a null result:

  • Fewer than three non-null data points in the data used for the computation
  • STDDEV_SAMP(x) = 0
  • Division by zero