当前位置:网站首页>Numeric types in SQL. Try to avoid using null as the default value

Numeric types in SQL. Try to avoid using null as the default value

2022-06-13 08:18:00 Parthenocissus still works

Development process , Because there was a field before A Is a numeric type and the default value is set to NULL, That is to say, if no value is specified during insertion, the default value is (NULL), This leads to some statistics later , Another field exists B It's also a number type , In Statistics A+B Field and if one of the values is (NULL) Then the added value is still (NULL). The proportion A The value is (NULL),B The value is 2.5, be sql sentence SELECT NULL + 2.5; The result of the inquiry is (NULL). This may not be the same as what we expect .

原网站

版权声明
本文为[Parthenocissus still works]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202270544564414.html