I'm trying to create a table in postgres of product promotions, this is a simplified example:
create table promotions ( product_id text, start_date date, end_date date, discount numeric(5, 4) ) For a particular product there shouldn't be overlapping promotions, i.e., the table shouldn't allow to have two rows for the same product_id with overlapping date ranges.
I don't know if it is possible, but I see this best coded as a constraint.
I've been looking around for solutions but I couldn't find anyone for this particular problem.