数字 

numbers(N) – Returns a table with the single ‘number’ 包含从0到N-1的整数的列(UInt64)。
numbers(N, M) -返回一个表与单 ‘number’ 包含从N到(N+M-1)的整数的列(UInt64)。

类似于 system.numbers 表,它可以用于测试和生成连续的值, numbers(N, M)system.numbers.

以下查询是等效的:

SELECT * FROM numbers(10);
SELECT * FROM numbers(0, 10);
SELECT * FROM system.numbers LIMIT 10;

例:

-- Generate a sequence of dates from 2010-01-01 to 2010-12-31
select toDate('2010-01-01') + number as d FROM numbers(365);

原始文章

Rating: 5 - 6 votes

Was this content helpful?
★★★★★