Constraint like check constraints, not null constraints on MyISAM Storage Engines in MySQL
Can we use constraint like check constraints, not null constraints on MyISAM Storage Eng开发者_开发技巧ines in MySQL?
MyISAM supports NOT NULL.
Mostly.
Unless in batch insert mode, MySQL will insert the 'implicit default' of a column and maybe throw a warning. To prevent this you must enable the strict
sql mode.
As for check clauses, MySQL will accept the syntax but totally ignore it in table definitions.
A default MySQL installation doesn't really stop you from violating the NOT NULL constraint. Typically, you'll find nulls in not null columns when NOT NULL columns are added using ALTER TABLE but no data is added later.
The Mysql server modes FAQ might also be a good start.
精彩评论