In my database, I have a prices table. Prices are valid for a set period of time or forever, but there always is a valid price at a given time.
I was wondering would you rather have a starts_at
and ends_at
columns, where ends_at
would always be equal to the previous starts_at
value, or only a starts_at
and query for the last one at a given date?
I can see the benefit of having between
capabilities, but on the other side it's a hassle to update a row, since it might impact ends_at
dates here and there.
end
column - the end of the price actuality period is defined by the nextstart
value if exists. Also you may easily convert this structure tostart-end
representation with according query or view at any time.