Sunteți pe pagina 1din 61

ANSI Compliance

COVAR_SAMP is ANSI SQL:2008 compliant.


Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,

This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty

pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs

By default, Teradata Database performs implicit type conversion on UDT arguments


that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ

es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.

For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.

Division by zero results in NULL rather than an error.


Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235

When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= -----------------------------------------------------------------------------------

Chapter 8: Aggregate Functions


COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))

COUNT(x)
1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1

1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to

determine their covariance.


The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:

Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.

Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.

COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions

COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.

Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition

Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2

ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,

This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty

pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs

By default, Teradata Database performs implicit type conversion on UDT arguments


that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ

es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.

For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.

Division by zero results in NULL rather than an error.


Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235

When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= -----------------------------------------------------------------------------------

Chapter 8: Aggregate Functions


COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))

COUNT(x)
1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1

1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to

determine their covariance.


The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:

Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.

Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.

COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions

COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.

Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition

Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2

ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,

This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty

pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs

By default, Teradata Database performs implicit type conversion on UDT arguments


that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ

es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.

For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.

Division by zero results in NULL rather than an error.


Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235

When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= -----------------------------------------------------------------------------------

Chapter 8: Aggregate Functions


COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))

COUNT(x)
1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1

1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to

determine their covariance.


The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:

Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.

Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions
COVAR_SAMP 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 9: Ordered Analytical Functions.

COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2
ANSI Compliance
COVAR_SAMP is ANSI SQL:2008 compliant.
Definition
Covariance measures whether or not two random variables vary in the same way. It
is the sum
of the products of deviations for each non-null data point pair.
Note that high covariance does not imply a causal relationship between the varia
bles.
Combination With Other Functions

COVAR_SAMP 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 9: Ordered Analytical Functions.
COVAR_SAMP cannot be combined with aggregate functions within the same SELECT li
st,
QUALIFY clause, or ORDER BY clause.
Computation
The equation for computing COVAR_SAMP is defined as follows:
where:
Syntax element
Specifies
value_expression_2 a numeric expression to be paired with a second numeric expre
ssion to
determine their covariance.
The expressions cannot contain any ordered analytical or aggregate functions.
value_expression_1
1101A456
COVAR_SAMP ( value_expression_1, value_expression_2 )
COVAR_SAMP SUM((x
AVG(x))(y
AVG(y)))
COUNT(x) 1
= ----------------------------------------------------------------------------------Chapter 8: Aggregate Functions
COVAR_SAMP
SQL Functions, Operators, Expressions, and Predicates 235
When there are no non-null data point pairs in the data used for the computation
, then
COVAR_SAMP returns NULL.
Division by zero results in NULL rather than an error.
Result Type and Attributes
The data type, format, and title for COVAR_SAMP(y, x) are as follows.
For information on the default format of data types and an explanation of the fo
rmatting
characters in the format, see Data Type Formats and Format Phrases in SQL Data Typ
es and
Literals.
Support for UDTs
By default, Teradata Database performs implicit type conversion on UDT arguments
that have
implicit casts that cast between the UDTs and any of the following predefined ty
pes:
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
COVAR_SAMP, is a Teradata extension to the ANSI SQL standard. To disable this ex
tension,
This variable
Represents
x value_expression_2

S-ar putea să vă placă și