IFNULL() Function SQL

In mySQL IFNULL(param1,param2) asks if param1 is null. If param1 is NOT null then it is returned. However, if it is null then param2 will be returned.

For example given:


The result would be "1".

In the case of:


The result would be "7".

On other platforms try ISNULL(), NVL(), or COALESCE(), all of which work as above. Not necessarily the case, but most often the last parameter will be zero, because this often acts appropriately to the idea of NULL in a calculation. It is important to stress that NULL is not zero and will most likely throw an error if used in calculations.

< HEX Function SQL | LEN function >

Interesting Pages