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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.