ClickHouse/tests/queries/0_stateless/02316_expressions_with_window_functions.sql

21 lines
532 B
MySQL
Raw Normal View History

2022-06-13 23:11:22 +00:00
-- { echoOn }
-- SELECT number, sum(number) + 1 OVER (PARTITION BY (number % 10))
-- FROM numbers(100)
-- ORDER BY number; -- { clientError SYNTAX_ERROR }
SELECT number, 1 + sum(number) OVER (PARTITION BY number % 10)
2022-06-13 23:11:22 +00:00
FROM numbers(100)
ORDER BY number;
SELECT sum(number) + 1 AS x
FROM numbers(100)
GROUP BY number % 10
ORDER BY x;
SELECT
number,
sum(number) OVER (PARTITION BY number % 10) / count() OVER (PARTITION BY number % 10),
avg(number) OVER (PARTITION BY number % 10)
FROM numbers(100)
ORDER BY number ASC;