I have 4 integer columns in my table. They are not required to be filled. So some of them may be filled, some not. When they are not filled, mysql add 0 to that column. I tried to change column default value to NULL and it told Invalid default value. Is there any way to get empty row without having there the zero?
"Is there any way to get empty row without having there the zero?"
To have NULL in the column by default use the following syntax in create table:
`column` int(10) unsigned DEFAULT NULL,
To alter the existing column:
ALTER TABLE table_name CHANGE COLUMN `column_name` `column_name` int(10) unsigned DEFAULT NULL;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With