Postgresql – how to select the inserted row in the last 15min automatically

i'm working on a table where new rows inserted everyday and we have a column where we persist the date/time for each new row.

ID      creation_date
56547   20/07/2021 11:47
56546   20/07/2021 11:47
56545   20/07/2021 11:47
56544   20/07/2021 11:45
56543   20/07/2021 11:45
56542   20/07/2021 11:44
56541   20/07/2021 11:44
56540   20/07/2021 11:43
56539   20/07/2021 11:42
56538   20/07/2021 11:42
56536   20/07/2021 11:41
56537   20/07/2021 11:41
56535   20/07/2021 11:41
...

i want to select the rows instered in the last 15min (sysdate-15). i'm new to postgresql i found that there is the function CURRENT_TIMESTAMP but this function return the date+time zone but in my column i have only HH:mm and i don't know how to add the -15min to the function..

do you have any idea how i can achieve this query ?

Thanks in advance



Read more here: https://stackoverflow.com/questions/68482717/postgresql-how-to-select-the-inserted-row-in-the-last-15min-automatically

Content Attribution

This content was originally published by James at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: