跳到主要内容
版本:4.x

NUMBERS

描述​

表函数,生成一张只含有一列的临时表,列名为number,如果指定了const_value,则所有元素值均为const_value,否则为[0,number) 递增。

语法​

NUMBERS(
"number" = "<number>"
[, "const_value" = "<const_value>" ]
);

必填参数​

字段描述
number行数

选填参数​

字段描述
const_value常量值

返回值​

字段名类型描述
numberBIGINT指定每行返回的值

举例​

select * from numbers("number" = "5");
+--------+
| number |
+--------+
| 0 |
| 1 |
| 2 |
| 3 |
| 4 |
+--------+
select * from numbers("number" = "5", "const_value" = "-123");
+--------+
| number |
+--------+
| -123 |
| -123 |
| -123 |
| -123 |
| -123 |
+--------+