boundingRatio
Calculates the slope between the leftmost and rightmost points across a group of values.
This page describes the RawTree engine binary used to generate this reference. It does not define Query API support. Descriptions retain upstream ClickHouse terminology. See SQL interface scope.
Calculates the slope between the leftmost and rightmost points across a group of values.
Syntax
boundingRatio(x, y)Arguments
x— X-coordinate values.(U)Int*orFloat*orDecimaly— Y-coordinate values.(U)Int*orFloat*orDecimal
Returned value
Returns the slope of the line between the leftmost and rightmost points, otherwise returns NaN if the data is empty. Float64
Examples
Sample data
SELECT
number,
number * 1.5
FROM numbers(10)┌─number─┬─multiply(number, 1.5)─┐
│ 0 │ 0 │
│ 1 │ 1.5 │
│ 2 │ 3 │
│ 3 │ 4.5 │
│ 4 │ 6 │
│ 5 │ 7.5 │
│ 6 │ 9 │
│ 7 │ 10.5 │
│ 8 │ 12 │
│ 9 │ 13.5 │
└────────┴───────────────────────┘Usage example
SELECT boundingRatio(number, number * 1.5)
FROM numbers(10)┌─boundingRatio(number, multiply(number, 1.5))─┐
│ 1.5 │
└──────────────────────────────────────────────┘Introduced in version 20.1.0.