views:

289

answers:

2

Can we use constraint like check constraints, not null constraints on MyISAM Storage Engines in MySQL?

+1  A: 

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.

ʞɔıu
A: 

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.

memnoch_proxy