I have the following table:
CREATE TABLE `Foo` (
`id` int NOT NULL,
`FirstName` varchar(255) NULL,
`LastName` varchar(255) NOT NULL DEFAULT 'NONE',
PRIMARY KEY (`id`)
);
When I run the following query it take the default value of 'NONE':
INSERT INTO Foo (`FirstName`) VALUES('FOO');
When I run the following query:
INSERT INTO Foo (`FirstName`, `LastName`) VALUES('FOO', NULL);
it gives an error:
[Err] 1048 - Column 'LastName' cannot be null
What I want to achieve is that if a value is NULL then MySQL should use the DEFAULT value.
Does anybody know the solution?
not nullthats why