Re: Is anything ever equal to NULL?

2009-12-29 Thread Joerg Bruehe
Martijn, thanks for your excellent mail: Martijn Tonies wrote: > [[...]] > > A column can have two states: null or not null. It either has > data (a value, depending on the datatype), or no data (null), > which is where IS NULL (has no data) or > IS NOT NULL (has data) comes into play. To ma

Re: Is anything ever equal to NULL?

2009-12-28 Thread Martijn Tonies
Well, if nothing can ever equal null, then why isn't MySQL query parser smart enough to reduce my queries to something more sensible? If I'm saying this: SELECT * FROM sometable WHERE somecolumn = NULL OR somecolumn = 'abc'; Why isn't it able to reduce the query to something more lik

Re: Is anything ever equal to NULL?

2009-12-28 Thread D. Dante Lorenso
Well, if nothing can ever equal null, then why isn't MySQL query parser smart enough to reduce my queries to something more sensible? If I'm saying this: SELECT * FROM sometable WHERE somecolumn = NULL OR somecolumn = 'abc'; Why isn't it able to reduce the query to something more like t

Re: Is anything ever equal to NULL?

2009-12-28 Thread David Giragosian
On Mon, Dec 28, 2009 at 5:41 PM, Carsten Pedersen wrote: > David Giragosian skrev: > >> On Mon, Dec 28, 2009 at 2:32 PM, D. Dante Lorenso >> wrote: >> >> Will anything ever be equal to NULL in a SELECT query? >>> >> > ... > > What's so special about NULL? >>> >> >> >> http://dev.mysql.com/doc/r

Re: Is anything ever equal to NULL?

2009-12-28 Thread Carsten Pedersen
David Giragosian skrev: On Mon, Dec 28, 2009 at 2:32 PM, D. Dante Lorenso wrote: Will anything ever be equal to NULL in a SELECT query? ... What's so special about NULL? http://dev.mysql.com/doc/refman/5.0/en/working-with-null.html Should answer some of your questions, Dante. Oddly e

Re: Is anything ever equal to NULL?

2009-12-28 Thread Martijn Tonies
Hi, Will anything ever be equal to NULL in a SELECT query? No, never. Null also means "unknown", if you design your tables well enough, there should be no NULLs -stored- (different from a resultset, where there can be nulls, for example in LEFT JOINs), because it's no use to store what you d

Re: Is anything ever equal to NULL?

2009-12-28 Thread David Giragosian
On Mon, Dec 28, 2009 at 2:32 PM, D. Dante Lorenso wrote: > > Will anything ever be equal to NULL in a SELECT query? > > SELECT * > FROM sometable > WHERE somecolumn = NULL; > > I have a real-life query like this: > > SELECT * > FROM sometable > WHERE somecolumn = NULL OR somecolumn = 'abc';

Re: Is anything ever equal to NULL?

2009-12-28 Thread Michael Dykman
No, nothing will ever equal null. In strict relational theory, which I don't know well enough to begin expounding on here, null does not even equal another null. That's why SQL provides IS NULL and IS NOT NULL as explicit cases. - michael dykman On Mon, Dec 28, 2009 at 2:32 PM, D. Dante Lorens

Is anything ever equal to NULL?

2009-12-28 Thread D. Dante Lorenso
Will anything ever be equal to NULL in a SELECT query? SELECT * FROM sometable WHERE somecolumn = NULL; I have a real-life query like this: SELECT * FROM sometable WHERE somecolumn = NULL OR somecolumn = 'abc'; The 'sometable' contains about 40 million records and in this query, i