I have a table with references from two of it's columns to two other tables PK's. Is there a way I can restrict both of those columns from having values set?
I only want one of them to have a value set, while the other is NULL
Favorites:
id
table_1_id
table_2_id
Table_1:
id
Table_2:
id
In SQL, you'd ideally handle this with a CHECK constraint.
In MySQL, there is not a direct mechanism to impose such a CHECK constraint. If you try to include one, the MySQL Reference Manual states (since it's part of the standard):
The CHECK clause is parsed but ignored by all storage engines.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With