4 messages in com.mysql.lists.mysqlRe: Not Null isn't working or am I wrong
FromSent OnAttachments
mapa...@epix.net04 Apr 2003 13:23 
Paul DuBois05 Apr 2003 09:06 
Bruce Feist05 Apr 2003 15:27 
gerald_clark07 Apr 2003 06:23 
Subject:Re: Not Null isn't working or am I wrong
From:Paul DuBois (pa@snake.net)
Date:04/05/2003 09:06:43 AM
List:com.mysql.lists.mysql

At 16:23 -0500 4/4/03, <mapa@epix.net> wrote:

Hi everyone, When creating a table I have a autonumber primary key, a varchar(30) field that is not null and another field that not null is not selected. Here is the table creation command i used.

CREATE TABLE `TableName` (`ID` INT (3) UNSIGNED DEFAULT '0' NOT NULL AUTO_INCREMENT, `name` VARCHAR (30) NOT NULL, `place` CHAR (30), PRIMARY KEY(`ID`), UNIQUE(`ID`), INDEX(`ID`));

Now when i put data into the table i can't have all blanks which is right. When i put data into the field that allows nulls the not null one gets '' as its data and goes on. I though NULL and '' were the same thing. Am i nuts?

I don't know if you're nuts or not, but NULL and the empty string are very definitely not the same thing.

INSERT INTO TableName (ID, name, place) VALUES (NULL, NULL, NULL); gives me and error which is what I want

but INSERT INTO TableName (ID, name, place) VALUES (NULL, '', NULL);

goes without any problem and i thought it should return and error also

It won't, because '' is different than NULL.

thanks for any help or comments

,Michael