Reputation: 379
I have the following two foreign keys
:
CONSTRAINT `FK_rel_object-user_users` FOREIGN KEY (`User`) REFERENCES `_users` (`ID`),
CONSTRAINT `FK__rel_object-user__map_usernames` FOREIGN KEY (`User`) REFERENCES `_map_usernames` (`ID`)
How can I define, that the data should exist in _users OR
_map_usernames instead of AND
Upvotes: 0
Views: 47
Reputation: 126
No.
That is, you cannot create a foreign key constraint this way. You can however, use a foreign key without a foreign key constraint.
All a foreign key is, is the value of another table's (or another record in the same table) primary key, which can be used in joins. In fact, you could reference fields other than the primary key, if all you need is to use the value for joins.
Upvotes: 1