I am building an analytics database (I have a firm understanding of the data and the business objectives and only basic-to-moderate database skills).
I have come acr
In PostgreSQL
, you can generate calendar tables of arbitrary length and granularity on the fly:
SELECT CAST('2011-01-01' AS DATE) + (n || ' hour')::INTERVAL
FROM generate_series(0, 23) n
This does not require recursion (as with the other systems) and is a preferred method to generate the volatile resultsets.