2020-04-03 13:23:32 +00:00
---
2022-08-28 14:53:34 +00:00
slug: /en/sql-reference/table-functions/numbers
2023-06-23 13:16:22 +00:00
sidebar_position: 145
2022-04-09 13:29:05 +00:00
sidebar_label: numbers
2020-04-03 13:23:32 +00:00
---
2022-06-02 10:55:18 +00:00
# numbers
2018-03-13 23:33:56 +00:00
2020-03-20 10:10:48 +00:00
`numbers(N)` – Returns a table with the single ‘ number’ column (UInt64) that contains integers from 0 to N-1.
`numbers(N, M)` - Returns a table with the single ‘ number’ column (UInt64) that contains integers from N to (N + M - 1).
2018-03-13 23:33:56 +00:00
2018-09-06 18:15:16 +00:00
Similar to the `system.numbers` table, it can be used for testing and generating successive values, `numbers(N, M)` more efficient than `system.numbers` .
2018-04-23 06:20:21 +00:00
2018-06-22 16:31:53 +00:00
The following queries are equivalent:
2018-03-13 23:33:56 +00:00
2020-03-20 10:10:48 +00:00
``` sql
2018-03-13 23:33:56 +00:00
SELECT * FROM numbers(10);
2018-09-06 18:15:16 +00:00
SELECT * FROM numbers(0, 10);
2018-03-13 23:33:56 +00:00
SELECT * FROM system.numbers LIMIT 10;
```
2018-04-23 06:20:21 +00:00
Examples:
2020-03-20 10:10:48 +00:00
``` sql
2018-09-06 18:15:16 +00:00
-- Generate a sequence of dates from 2010-01-01 to 2010-12-31
2018-03-13 23:33:56 +00:00
select toDate('2010-01-01') + number as d FROM numbers(365);
```