mysql - "null" in mathematical calculations? -
i'm trying make mysql query returns rows (col_a+col_b-col_c+col_d) != col_e
, of columns decimal
, default null
. there 1 row know of meets these requirements, when ran query above logic where
clause, row didn't show up. noticed col_c
null
, instead of numerical value, , after changing 0
row showed when ran query.
why did happen? have assumed null
interpreted 0
in instance such above?
null
(as far interpretation goes) unrepresentable data. appropriate tests null is null
, is not null
, , several functions made handle null
values: http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html
you - ifnull(col_c, 0)+col_d
(coalesce
work identically in case).
more information on working null
s: http://dev.mysql.com/doc/refman/5.0/en/problems-with-null.html
Comments
Post a Comment