REGR_AVGY Function Example | Mean Function | Teradata Vantage - Example: Returning the Mean Weight from regrtbl - Advanced SQL Engine - Teradata Database

SQL Functions, Expressions, and Predicates

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-28
dita:mapPath
SQL_Functions__Expressions__and_Predicates.Upload_071421/djk1612415574830.ditamap
dita:ditavalPath
SQL_Functions__Expressions__and_Predicates.Upload_071421/wrg1590696035526.ditaval
dita:id
B035-1145
lifecycle
previous
Product Category
Teradata Vantageā„¢

This example is based the following regrtbl data. Nulls are indicated by the QUESTION MARK character.

c1   height   weight
--   ------   ------
 1       60       84
 2       62       95
 3       64      140
 4       66      155
 5       68      119
 6       70      175
 7       72      145
 8       74      197
 9       76      150
10       76      ?
11       ?       150
12       ?       ?

The following SELECT statement returns the mean weight from regrtbl where neither height nor weight is null.

   SELECT REGR_AVGY(weight,height) 
   FROM regrtbl;
   
   Regr_Avgy(weight,height)
   ------------------------
                        140