create PostgreSQL schema
Budget: $30 – $250 USD
I have a simple table in PostgreSQL bcu
Table "public.bcu"
Column | Type | Collation | Nullable | Default
-------------------------+-----------------------------+-----------+----------+---------
time | timestamp without time zone | | not null |
batteryready | smallint | | |
moduletemperature_alarm | smallint | | |
cellvoltage_alarm | smallint | | |
current_alarm | smallint | | |
communications_alarm | smallint | | |
I need to create a new schema where there is a table for each day of the year
bcu_2022_01_01
bcu_2022_01_02
bcu_2022_01_03
bcu_2022_01_04
bcu_2022_01_05
...
and so on for each day of the year.
Then there will be a view that combines all these tables.
For example, if the query is
SELECT cellvoltage_alarm
FROM bcu0
WHERE
""time"" BETWEEN '2022-02-28T16:17:58.638Z' AND '2022-02-28T19:17:58.638Z'
then the query should be directed to table bcu_2022_02
The project is to create these tables and a view and deliver the schema dump.
Table "public.bcu"
Column | Type | Collation | Nullable | Default
-------------------------+-----------------------------+-----------+----------+---------
time | timestamp without time zone | | not null |
batteryready | smallint | | |
moduletemperature_alarm | smallint | | |
cellvoltage_alarm | smallint | | |
current_alarm | smallint | | |
communications_alarm | smallint | | |
I need to create a new schema where there is a table for each day of the year
bcu_2022_01_01
bcu_2022_01_02
bcu_2022_01_03
bcu_2022_01_04
bcu_2022_01_05
...
and so on for each day of the year.
Then there will be a view that combines all these tables.
For example, if the query is
SELECT cellvoltage_alarm
FROM bcu0
WHERE
""time"" BETWEEN '2022-02-28T16:17:58.638Z' AND '2022-02-28T19:17:58.638Z'
then the query should be directed to table bcu_2022_02
The project is to create these tables and a view and deliver the schema dump.
Related categories:
PostgreSQL