PostgreSQL/Postgre SQL/generate series
Содержание
generate_series(0,14,7)
postgres=# select current_date + s.a as dates from generate_series(0,14,7) as s(a);
dates
------------
2006-10-19
2006-10-26
2006-11-02
(3 rows)
postgres=#
postgres=#
generate_series(4,3)
postgres=# select * from generate_series(4,3);
generate_series
-----------------
(0 rows)
postgres=#
generate_series(5,1,-2)
postgres=# select * from generate_series(5,1,-2);
generate_series
-----------------
5
3
1
(3 rows)
postgres=#
generate_series demo
postgres=#
postgres=# select * from generate_series(2,4);
generate_series
-----------------
2
3
4
(3 rows)
postgres=#