I have the following already created table in DBeaver:
Let’s say that from this dataset in the ss On the 1st of August i want to add 2023-08-01 and delete 2021-07-01 from the 1st row.
I am using this to update a dashboard timeline with the last 24 months, taking into consideration the current timestamp.
Until now I updated it manually, but now I want to make an automatic procedure in DBeaver to run daily to check if the current timestamp is the 1st of the month, and if yes to add that date into the table and delete the 1st row of the table.
How can I do that?
For the moment I just surfed the web in search for answers, I am still a beginner in this,
2
Answers
Your approach is wrong. Fill the
date_month
table with data for all expected past and future dates, then use a simple query to select past 24 months:Assuming you start with the table above, you can remove the first month and add the last in one
UPDATE
query:This adds 1 month to every date, thus advancing the whole table by one month.