We have a situation where we need to have a RI constraint on a non-Primary key column of the table.
Scenario:
**TABLE_2**
**Unique_Key Expression_Key Data**
132 ASDF123 qweqwr
458 PQRS789 abcd
**TABLE_1**
**Unique_Key Expression_Key Expression_Rule**
XYZ123 ASDF123 Fname = Simon
ABC123 ASDF123 Lname = Kelso
QWE123 ASDF123 Age = 89
FRU123 ASDF123 Gender = M
RTY3435 PQRS789 Fname = Michael
TYR134 PQRS789 Lname = John
The requirement is, if I get the value of 132 - then I need to evaluate the rule of expression_id ASDF123. This Expression ID is not a primary key of Table_1 but its unique for all the rows which are related to that expression.
Can we implement an RI constraint in the above scenario, where the Table_1.Expression_Key = Table_2.Expression_Key if this condition is not met while inserting the data, it should throw an error.