G
G
grazer2021-05-20 18:52:09
PostgreSQL
grazer, 2021-05-20 18:52:09

How to implement IF then check on write?

Good day.

There is a table dates in which there are three columns: start_date (DATE), end_date (DATE) and is_end (INTEGER). DEFAULT CURRENT_TIMESTAMP is set for the end_date column, and DEFAULT 0 for is_end.

The implementation of the following functionality is of interest: check WHEN WRITING, if more than 14 days have passed from the start date (start_date) to the end date (end_date), then 1 will be automatically written in the is_end field , if the condition is not met, then 0.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question