check constraint won't work mysql [duplicate]
问题 This question already has answers here : CHECK constraint in MySQL is not working (8 answers) Closed 11 months ago . check constraint won't work CREATE TABLE IF NOT EXISTS supervisor ( sup_id INT(3) NOT NULL, sup_name VARCHAR(30) NOT NULL, gen VARCHAR(1) NOT NULL CHECK (gen='M' or gen='F'), dep_id INT(4), PRIMARY KEY (sup_id), INDEX (dep_id), FOREIGN KEY (dep_id) REFERENCES department(dep_id) ON UPDATE CASCADE ON DELETE RESTRICT ); i also tried: CONSTRAINT chk_supervisor_gen CHECK ('M' or 'F'