a constraint requires me that. "the value of B, present in table B1, must always be less than that of A present in table C1".
is it correct to implement two triggers to do this? one that is activated when B1 is inserted and modified and one when C1 is modified?
In the constraint dictionary documentation should it be indicated with a single constraint or separate ones?
The constraint spans two tables. So you cannot consider constraint checks as these are limited to a simple expression involving only columns of the same table.
Since each table could be updated independently, it is correct to consider a solution based on two BEFORE
triggers, an UPDATE
trigger on C1
and an UPDATE
/INSERT
trigger on B1
.
Regarding documentation, it is conceptually a single constraint in the model, which has to be enforced in two places in the implementation. I'd therefore recommend to document it as one constraint that is cross referenced several time in the implementation. This allows to keep the picture and remind that it is the two sides of the same coin, and not two different constraints. (unless you refer to some dictionary in a supporting tool, in which case you'd need to say more)