I am using MySQL
and here is a simple query set:
create table dcheck (
fdate date,
sdate date,
check (fdate <= sdate)
);
insert
-
CHECK constraints are now supported since MySQL 8.0.16
讨论(0)
-
MySQL doesn't implement CHECK constraints. From the latest (5.6) fine manual:
The CHECK
clause is parsed but ignored by all storage engines.
So the syntax is parsed for compatibility other other SQLs but the checking is not implemented.
You could fake your CHECK constraint with BEFORE INSERT and BEFORE UPDATE triggers that threw an exception if the desired condition was not met.
讨论(0)
-
The CHECK clause is parsed but ignored by all storage engines.
http://dev.mysql.com/doc/refman/5.1/en/create-table.html
讨论(0)
- 热议问题