[UPHPU] discovered ISNULL() for default join values in MySQL

Joseph Scott joseph at josephscott.org
Mon Feb 22 17:18:03 MST 2010


On Mon, Feb 22, 2010 at 5:03 PM, Wade Preston Shearer
<wadeshearer.lists at me.com> wrote:
>>You can also use a slick function called coalesce which most db
>>engines support.
>
> I looked coalesce up and don't see how would work in this case. Will you provide an example?


You didn't provide a specific query to compare with so hard to say
exactly how you would use it in your case.  A few years back I ran
into the oddities of null checking in DBs -
http://joseph.randomnetworks.com/archives/2006/03/15/nvl-isnull-ifnull-and-coalesce/

And just to make it even more interesting, MySQL has IS_NULL -
http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#operator_is-null
- and ISNULL - http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#function_isnull

which could make for one tongue twister of a query :-)

COALESCE could be thought of as more generalized null check -
http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#function_coalesce



-- 
Joseph Scott
joseph at josephscott.org
http://josephscott.org/


More information about the UPHPU mailing list