I have a table in my database (TableA) that has a column (TableA.Column1) that allows only values โโfrom certain rows of another table (TableB.Column2). This is very similar to the normal foreign key relationship, except that only certain rows from TableB.Column2 are allowed. For example, I can only allow rows from TableB.Column2, where TableB.Column3> 100;
Is there a way to express this type of referential integrity in a database? I tried to add the where clause to the foreign key, and I tried to add a subquery to the validation constraint. I do not work.
Does anyone have any tips?
source share