**Teradata skew** function returns the skewness of the distribution of *value_expression*.

**SYNTAX:**

`SKEW([TYPE] `*value_expression*)

Where *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.

[TYPE] is optional and TYPE as ALL means that all non-null values specified by *value_expression*, including duplicates, are included in the computation for the group. This is the default.

TYPE as DISTINCT means that null and duplicate values specified by *value_expression* are eliminated from the computation for the group.

**Teradata 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.

Data type for SKEW(x) is REAL.

The equation for computing SKEW is defined as follows:

Query to find out **Teradata Skewness** in tables in the system

```
SELECT TSIZE.DatabaseName, TSIZE.TableName,
TDEF.CreateTimeStamp AS Created,
TDEF.LastAlterTimeStamp AS LastAltered ,
TDEF.AccessCount,
TDEF.LastAccessTimeStamp AS LastAccess,
SUM(TSIZE.CurrentPerm) AS SCurrentPerm,
SUM(TSIZE.CurrentPerm)/1024/1024 AS SCurrentPerm_MB,
SUM(TSIZE.PeakPerm) AS SPeakPerm,
SUM(TSIZE.PeakPerm)/1024/1024 AS SPeakPerm_MB,
(100 - (AVG(TSIZE.CurrentPerm)/MAX(TSIZE.CurrentPerm)*100)) AS SkewFactor
FROM DBC.TableSize TSIZE JOIN DBC.Tables TDEF
ON TSIZE.DatabaseName = TDEF.DatabaseName
AND TSIZE.TableName = TDEF.TableName
GROUP BY 1,2,3,4,5,6
--ORDER BY SCurrentPerm_GB DESC, skewFactor
HAVING SCurrentPerm_MB > 100 AND skewFactor > 50
ORDER BY SCurrentPerm_MB DESC, skewFactor;
```

- 678 reads