Introduced in: v26.9.0
Returns the slope of the least-squares fit of y on x:
Returns nan when x is constant, because the fitted line is vertical.
Syntax
regr_slope(y, x)Arguments
Returned value
Returns the slope of the regression line. Float64
Examples
Basic usage
SELECT regr_slope(y, x)
FROM VALUES('x Float64, y Float64', (1, 2), (2, 4), (3, 6), (4, 8))┌─regr_slope(y, x)─┐
│ 2 │
└──────────────────┘