NULL values in MySQL database after I set default '0' to the column -


i have payouts table whom set default 0.000 total_tips column (extract table schema):

total_tips       | decimal(12, 4) | yes  |      | 0.0000 | <- default set '0.0000' 

but now, can explain why have still null values inside table:

mysql> select total_tips payouts id = 4157; +------------+ | total_tips | +------------+ |       null | +------------+ 1 row in set (0.00 sec) 

before ran alter command (to set default value):

mysql> alter table payouts change total_tips total_tips decimal(12,4) default 0 ; 

you maybe didn't set value not null, null value accepted. need update whole base with:

update payouts set total_tips = 0 total_tips null 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -