Hmm, you are absolutely correct. This throws an unpleasant doubt on all of the statistics I have provided to clients based on SQL queries over the years. Have you checked whether or not this is a listed bug on the MySQL developers list?
Essential readings for professionals related to database theory and practice. This Blog focuses on Database theory applied to practical issues in current DBMSs. I began with some readings about SQL, because anybody who works with this language should know the weaknesses and conflictive characteristics of it, this site has a publication that contains essential readings about it.
I've been reading the mathematical roots the Relational Model has, it's essential, only theories that have mathhematical roots live forever. 4 months ago
We have to live with null we cannot avoid it completely, ex. OUTER JOIN, but we have to be conscious about it 4 months ago
Hmm, you are absolutely correct. This throws an unpleasant doubt on all of the statistics I have provided to clients based on SQL queries over the years. Have you checked whether or not this is a listed bug on the MySQL developers list?
Yes, it is interesting to see how nulls destroy all kinds of mathematical properties. Consider for example:
with T(a,b) as (
values (null,null),(1,null),(null,1),(1,1)
)
select sum(a)+sum(b) as sum_a_plus_sum_b,
sum(a+b) as sum_a_plus_b
from T
SUM_A_PLUS_SUM_B SUM_A_PLUS_B
—————- ————
4 2
I.e. sum(a) + sum(b) sum(a+b)