Returns the slope of the univariate linear regression line through all non-null data pairs of the dependent and independent variable arguments.
For the REGR_SLOPE window function that performs a group, cumulative, or moving computation, see Window Aggregate Functions.
Slope
The slope of the best fit linear regression is a measure of the rate of change of the regression of one independent variable on the dependent variable.
The plot of the linear regression on the variables is used to predict the behavior of the dependent variable from the change in the independent variable.
Note that this computation assumes a linear relationship between the variables.
There can be a strong nonlinear relationship between independent and dependent variables, and the computation of the simple linear regression between such variable pairs does not reflect such a relationship.
Independent and Dependent Variables
An independent variable is a treatment: something that is varied under your control to test the behavior of another variable.
A dependent variable is something that is measured in response to a treatment.
For example, you might want to test the ability of various promotions to enhance sales of a particular item.
In this case, the promotion is the independent variable and the sales of the item made as a result of the individual promotion is the dependent variable.
Computation
When there are fewer than two non-null data point pairs in the data used for the computation, then REGR_SLOPE returns NULL.
Division by zero results in NULL rather than an error.