MySQL default error
In MySQL, the default value for an integer field is 0. On insertion, the value for that field is NULL and NULL will be inserted. I am doing some arithmetic manipulation like addition, animation, division using this field value. This results in an error when inserting NULL. How to solve this problem? Don't support the default database value for fields like integer, decimal (maybe not for string types, since NULL is valid for a string) if their insert value is null. If not, is it correct to have NULL values ββfor numeric types?
For some reason When I have a decimal field with NOT NULL and DEFAULT VALUE as 0, the insert fails with the error "Data is truncated for column 'Column_Name' on row 1".
If I remove the NOT NULL property, the insert is done with the same message as the warning.
The value that is inserted in this decimal field is the result of the AVG () MySql function
Not surprising...
What could be the reason?
source to share