I currently have a foreign key between two entities, and I would like to make that relation conditional to the entityType of one of the tables. Here's the hierachy of tables, this is done via FK refrences from child to parent
Store
/ \
Employees \
TransactionalStores
/ | \
Kiosks | BrickMortars
Onlines
I currently have a FK relation from Employee to store
ALTER TABLE Employees ADD CONSTRAINT Employee_Store
FOREIGN KEY (TransStoreId)
REFERENCES TransactionalStores(StoreId)
I would like to add the conditional:
WHERE TransactionalStores.storeType != 'ONLINE_TYPE'
Is this possible or must I subclass TransactionalStores into two new subTypes (e.g. PhysicalStores and VirtualStores)