The content of this page has been automatically translated by AI. If you encounter any problems while reading, you can view the corresponding content in Chinese.

Sequence Functions

Last updated: 2024-08-22 16:25:43

The sequence functions provided by the database return multiple values as listed below.
Function
Parameter Type
Return Type
Description
Sample code
generate_series(start, stop)
Integer
Return a series of values
A series of values starting from start, auto-incrementing to stop
select * from generate_series(2,4);
generate_series
-----------------
2
3
4
(3 rows)
generate_series(start, stop, step)
Integer
Return a series of values
A series of values starting from start, auto-incrementing to stop with a step length of step
select * from generate_series(5,1,-2);
generate_series
-----------------
5
3
1
(3 rows)