My understanding is that MySql ignores CHECK in the CREATE TABLE syntax. I was therefore thinking – why not use triggers?
For example I have a table of people and one field is a phone number. Is it possible to construct a trigger to validate that the phone number is valid (e.g. the area code) and on the event of an invalid phone number to make the insertion fail with an appropriate error message?
Yes, you can create a trigger to validate inserted values and call an unknown procedure. For example –