Top "Generate-series" questions

Relating to the row generator function generate_series() in PostgreSQL

Generating time series between two dates in PostgreSQL

I have a query like this that nicely generates a series of dates between 2 given dates: select date '2004-03…

postgresql date time-series postgresql-9.1 generate-series
How to perform a select query in a DO block?

I want to port the below SQL code from MS SQL-Server to PostgreSQL. DECLARE @iStartYear integer DECLARE @iStartMonth integer DECLARE @…

sql postgresql plpgsql postgresql-9.1 generate-series
Using sql function generate_series() in redshift

I'd like to use the generate series function in redshift, but have not been successful. The redshift documentation says it's …

sql amazon-redshift generate-series
How can I generate a series of repeating numbers in PostgreSQL?

In PostgreSQL, is it possible to generate a series of repeating numbers? For example, I want to generate the numbers 1 …

sql postgresql generate-series
generate_series() equivalent in MySQL

I need to do a query and join with all days of the year but in my db there isn't …

mysql sql generate-series
Postgresql generate_series of months

I'm trying to generate a series in PostgreSQL with the generate_series function. I need a series of months starting …

sql postgresql time-series generate-series set-returning-functions
Insert multiple rows in one table based on number in another table

I am creating a database for the first time using Postgres 9.3 on MacOSX. Let's say I have table A and …

sql postgresql relational-database generate-series
Generate_series in Postgres from start and end date in a table

I have been trying to generate a series of dates (YYYY-MM-DD HH) from the first until the last date in …

sql postgresql aggregate-functions generate-series
Join a count query on generate_series() and retrieve Null values as '0'

I want to count ID's per month using generate_series(). This query works in PostgreSQL 9.1: SELECT (to_char(serie,'yyyy-mm')) …

sql postgresql join postgresql-9.1 generate-series
Calculate working hours between 2 dates in PostgreSQL

I am developing an algorithm with Postgres (PL/pgSQL) and I need to calculate the number of working hours between 2 …

sql postgresql date-arithmetic generate-series range-types