Attribute-Attribute Dependency
MySQL does not allow to define those kind of constraints, the only ones that are allowed are those related to indexes, such as UNIQUE or FOREIGN KEYs, or invalid data types. CHECK is not supported.

There are several options, depending on what you want to achieve.


First, there is obviously the option of doing application-only checks.
The recommended way on server side is to revoke INSERT and UPDATE access to the table from the user editing the information and enforce the usage of a couple of stored procedures to check the data before actually inserting it, so that the user has to CALL insert_my_table(colums, of, my, table).
You can also do some "hacks" like using a BEFORE INSERT/UPDATE TRIGGER that will force the transaction to fail if it detects a "wrong" value, as it was suggested on the previous link. This is easier to implement but a bit more ugly.