On Thu, 6 Feb 2003 12:05:03 -0500, Doug Beyer wrote: > >I create the following table: > >create table t1 ( id varchar(5) not null, name varchar(5) not null ); > >I insert the following row: > >insert into t1 ( id ) values ( "1234" ); > >I do the following selects: > >select count(*) from t1 where name is null; --> Result = 0 > >select count(*) from t1 where name = ""; --> Result = 1 > > >Questions: >1) Why did the insert succeed since the "name" field is not null and I didn't provide >a value? >2) Why does MySql think it's correct to substitute an empty string for a non-provided >value?
1) MySQL inserts the default value(s) to complete the row. 2) Because you specified the column to be NOT NULL. hth, Doug --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php