Timerange Table SQL Presto Timerange Table SQL Presto database database

Timerange Table SQL Presto


Pro tipp, you might even be able to get away without a temporary table using the WITH syntax. And then in the following SELECT statement you can use hours as if it were a table.

WITH hours AS (SELECT * FROM UNNEST(ARRAY[0,1, ... 22,23]) AS t (hour))SELECT     * FROM     hours;


I would do this:

CREATE TABLE fakehours ASWITH hours AS (SELECT * FROM UNNEST(SEQUENCE(0,23,1)) AS t (hour))SELECT   * FROM hours;


Depending on your Presto version try:

SELECT * FROM UNNEST(SEQUENCE(0,23))

or

SELECT * FROM UNNEST(ARRAY[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])

Should achieve what you want in a join, short of having temp tables available in Presto.