sql - If a column has a default, is a NOT NULL constraint redundant? -


for example...

create table phone (     id            integer primary key,     country_code  integer not null default 1,     area_code     integer not null,     number        integer not null ); 

can safely remove not null country_code? it's messing orm's validation thinks country_code must defined.

no. default value used when don't set value.

if remove not null constraint, have initial value, still manually set null.


Popular posts from this blog