mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
33 lines
1.2 KiB
MySQL
33 lines
1.2 KiB
MySQL
|
SELECT number = 0 AS value, number AS time, exponentialMovingAverage(1)(value, time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth FROM numbers(10);
|
||
|
SELECT value, time, round(exp_smooth, 3) FROM (SELECT number = 0 AS value, number AS time, exponentialMovingAverage(10)(value, time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth FROM numbers(10));
|
||
|
|
||
|
SELECT number AS value, number AS time, exponentialMovingAverage(1)(value, time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth FROM numbers(10);
|
||
|
|
||
|
SELECT
|
||
|
value,
|
||
|
time,
|
||
|
round(exp_smooth, 3),
|
||
|
bar(exp_smooth, 0, 1, 50) AS bar
|
||
|
FROM
|
||
|
(
|
||
|
SELECT
|
||
|
(number = 0) OR (number >= 25) AS value,
|
||
|
number AS time,
|
||
|
exponentialMovingAverage(10)(value, time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth
|
||
|
FROM numbers(50)
|
||
|
);
|
||
|
|
||
|
SELECT
|
||
|
value,
|
||
|
time,
|
||
|
round(exp_smooth, 3),
|
||
|
bar(exp_smooth, 0, 1, 50) AS bar
|
||
|
FROM
|
||
|
(
|
||
|
SELECT
|
||
|
(number % 5) = 0 AS value,
|
||
|
number AS time,
|
||
|
exponentialMovingAverage(1)(value, time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth
|
||
|
FROM numbers(50)
|
||
|
);
|