Hardcoded SQL
Hardcoded table¶
-- | name1 | name2 | arr_col |
-- |--------+-------+------------|
-- | value1 | False | [123, 456] |
-- | value2 | True | [789] |
WITH table_name(name1, name2, hardcoded_array, hardcoded_json) AS (
VALUES ('value1', FALSE, ARRAY [123,456], '{}':JSON)
)
SELECT *
FROM table_name
Hardcoded table in a FROM¶
SELECT *
FROM
(VALUES
('Col1 Item 1', 'Col2 Item 1', 'Col3 Item 1', NULL),
('Col1 Item 2', 'Col2 Item 2', 'Col3 Item 2', FALSE)
)
AS my_table_name(col1, col2, col3, bool_col)
generate_series
¶
In a SELECT
¶
generate_series
in a FROM
¶
Series of months¶
+------------+
| month |
|------------|
| 2023-02-01 |
| 2023-03-01 |
| 2023-04-01 |
| 2023-05-01 |
| 2023-06-01 |
| 2023-07-01 |
| 2023-08-01 |
| 2023-09-01 |
| 2023-10-01 |
| 2023-11-01 |
| 2023-12-01 |
| 2024-01-01 |
+------------+
SELECT "month"
FROM GENERATE_SERIES(
( 2023 || '-02-01')::DATE,
( 2023 ::INT + 1 || '-01-31')::DATE,
INTERVAL '1 MONTH'
) AS "month"
Last update:
2023-04-24