Use desktop for interactive SQL sandbox

How to generate time series data in Postgres

Simple series

SELECT * FROM generate_series(1,3);

Date series

SELECT * from generate_series('2024-10-13 00:00:00'::timestamp, 
    '2024-10-13 23:00:00'::timestamp, '1 hour'::interval);

SQL Output

Getting Started
1Switch to a SQL tab and select a database
2Write or paste your SQL in the editor
3Press Alt+Enter to run
Tip:Select text in the editor to run only that portion
data-generation-postgres Updated 10/17/24, 1:56 AM
Notes SQL
Alt+Enter to run