mysql check constraints code example
Example 1: check constraint is violated
CONSTRAINT ck_ni_number
CHECK (REGEXP_LIKE(ni_number, '[a-z][a-z][0-9][0-9][0-9][0-9][0-9][0-9][a-z]'))
Example 2: mysql show check constraints
select COLUMN_NAME, CONSTRAINT_NAME, REFERENCED_COLUMN_NAME, REFERENCED_TABLE_NAME
from information_schema.KEY_COLUMN_USAGE
where TABLE_NAME = 'users';