Number Functions: Corr

Description: Returns the coefficient of correlation of a set of number pairs.

CORR(<expression1>, <expression2>) OVER (<analytic clause>)
conn sh/sh
SELECT t.calendar_month_number,
CORR (SUM(s.amount_sold), SUM(s.quantity_sold))
OVER (ORDER BY t.calendar_month_number) AS CUM_CORR
FROM sales s, times t
WHERE s.time_id = t.time_id AND calendar_year = 1998
GROUP BY t.calendar_month_number;

Enjoyed this post? Share it!


Leave a comment

Your email address will not be published.