CHECK constraint in MySQL is not working

后端 未结 8 2033
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:48

    Update to MySQL 8.0.16 to use checks:

    As of MySQL 8.0.16, CREATE TABLE permits the core features of table and column CHECK constraints, for all storage engines. CREATE TABLE permits the following CHECK constraint syntax, for both table constraints and column constraints

    MySQL Checks Documentation

    0 讨论(0)
  • 2020-11-21 05:48

    try with set sql_mode = 'STRICT_TRANS_TABLES' OR SET sql_mode='STRICT_ALL_TABLES'

    0 讨论(0)
提交回复
热议问题