Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
--generate_series
select
*
from
generate_series(0,100,10);
-- generate_series
-----------------
-- 0
-- 10
-- 20
-- 30
-- 40
-- 50
-- 60
-- 70
-- 80
-- 90
-- 100
--(11 rows)
--using our median function
select
median(val)
from
generate_series(0,100,5) as val;
-- median
--------
-- 50
--(1 row)
select
current_date + step.i as date_series
from
generate_series(0,14,2) as step(i);
-- date_series
-------------
-- 2013-04-09
-- 2013-04-11
-- 2013-04-13
-- 2013-04-15
-- 2013-04-17
-- 2013-04-19
-- 2013-04-21
-- 2013-04-23
--(8 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.