От: | BlackEric | http://black-eric.lj.ru | |
Дата: | 07.11.24 19:32 | ||
Оценка: |
CREATE UNIQUE INDEX UQ_Contracts_Country_Period
ON contracts (country, period_start, period_end)
WHERE NOT EXISTS (
SELECT 1
FROM contracts AS c
WHERE c.country = contracts.country
AND (
(contracts.period_start < c.period_end AND contracts.period_end > c.period_start)
)
);