CHECK constraint in MySQL is not working

后端 未结 8 2047
Happy的楠姐
Happy的楠姐 2020-11-21 05:15

First I created a table like

CREATE TABLE Customer (
  SD integer CHECK (SD > 0),
  Last_Name varchar (30),
  First_Name varchar(30)
);

8条回答
  •  长发绾君心
    2020-11-21 05:40

    Check constraints are supported as of version 8.0.15 (yet to be released)

    https://bugs.mysql.com/bug.php?id=3464

    [23 Jan 16:24] Paul Dubois

    Posted by developer: Fixed in 8.0.15.

    Previously, MySQL permitted a limited form of CHECK constraint syntax, but parsed and ignored it. MySQL now implements the core features of table and column CHECK constraints, for all storage engines. Constraints are defined using CREATE TABLE and ALTER TABLE statements.

提交回复
热议问题