0

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

1 Answer 1

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.