En slags
Cupon - is bound to -> Order;
Order - has active -> Cupon;
Cupon (
Id PK,
orderId FK Order.Id,
Unique ( Id, orderId) -- any superset of PK is unique
);
Order (
Id PK
ActiveCuponId,
(Id, ActiveCuponId) FK Cupon( OrderId, Id)
);
Se violin https://dbfiddle.uk/?rdbdbms=091qffda>https://dbfiddle.uk/?rdbdbms=091qffda>