CORR Function Example | VantageCloud Lake - Example: Querying Data from the HomeSales Table - Teradata VantageCloud Lake

Lake - Working with SQL

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2025-11-21
dita:mapPath
jbe1714339405530.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
jbe1714339405530

This example uses the data from the HomeSales table.

SalesPrice   NbrSold   Area
----------   -------   ---------
    160000       126   358711030
    180000       103   358711030
    200000        82   358711030
    220000        75   358711030
    240000        82   358711030
    260000        40   358711030
    280000        20   358711030

Consider the following query.

SELECT CAST (CORR(NbrSold,SalesPrice) AS DECIMAL (6,4)) 
FROM HomeSales
WHERE area = 358711030 
AND SalesPrice Between 160000 AND 280000;
   
CORR(NbrSold,SalesPrice)

Output:

-.9543

The result -.9543 suggests an inverse relationship between the variables. That is, for the area and sales price range specified in the query, the value for NbrSold increases as sales price decreases and decreases as sales price increases.