I have created a table with three columns, Id , Name , Quantity. It appears that when I am trying to insert a row with at least one null column or when i am trying to set the default value of a column to NULL the database throws an error. #1048 - Column 'Quantity' cannot be null
How can I set NULL as a valid value for a column?
ALTER TABLE mytable MODIFY quantity NUMERIC(20, 2)
Replace NUMERIC(20, 2) with your actual datatype, but without NOT NULL constraint.
To show your current column definitions, run
SHOW CREATE TABLE mytable
in mysql (the command line client)
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