©SQL :: Manager
HomeProgram InformationTechnical detailsFree downloadDonate for a cup of coffee
myway SQL Manager for MySQL and MariaDB, Download on Uptodown
SQL functionMySQLMariaDB

The ISNULL SQL Function in MySQL and MariaDB - Whether value is NULL query

ISNULLSyntax:ISNULL(Expression)
Return value:INTEGER
Function type:NULL function
Function Description

The ISNULL() function returns 1 if the value of "Expression" is NULL.

If the value of "Expression" is not NULL, ISNULL() returns 0.

SQL Examples for the ISNULL function

 1
 2
 3
 4
 5
 6
 7

SELECT isnull(null);
SELECT isnull(1);
SELECT isnull('test');
SELECT isnull(nullif(truetrue));
SELECT isnull(nullif(truefalse));

isnull(null)
int(1)
1
isnull(1)
int(1)
0
isnull('test')
int(1)
0
isnull(nullif(true, true))
int(1)
1
isnull(nullif(true, false))
int(1)
0
The examples were created with the MyWAY SQL manager: Download

How to use the ISNULL() function in MySQL and MariaDB databases

In MySQL and MariaDB there is the function ISNULL() that is used to check if a value is NULL or not, by returning 1 (true), if the expression is NULL or otherwise 0 (false). The function can be used in conditional filtering, for example in the WHERE clause to filter rows based on the NULL value of table columns or expressions. Furthermore, ISNULL() can be used in conditional expressions such as IF or CASE statements to process NULL values ​​and perform different actions based on their presence or to assign default values ​​to columns or expressions in result sets.

The behavior of ISNULL() differs from NULL comparisons with the equality operator (=). While ISNULL() specifically tests whether a value is NULL, the equality operator does not return true or false when comparing with NULL values, but NULL is always returned as the result.
IS_IPV4IS_IPV6IS_UUIDISNULLLAST_INSERT_IDLAST_VALUELASTVAL

Further MySQL und MariaDB SQL NULL functions

COALESCECOALESCE(%, %)
More about COALESCE Function

IFNULLIFNULL(Expression, Value)
More about IFNULL Function

NULLIFNULLIF(Expression 1, Expression 2)
More about NULLIF Function

NVLNVL(Expression, Value)
More about NVL Function

NVL2NVL2(Expression, Value1, Value2)
More about NVL2 Function

Numeric functionsString functionsRegular ExpressionsDate and Time functions
Comparison functionsEncryption & CompressionConversion functionsNULL functions
Aggregate functionsWindow functionsJSON functionsGeometric functions
Sequence functionsInformation functionsDynamic ColumnsMiscellaneous functions
More information about the ISNULL SQL function: mysql.com and mariadb.com and w3schools.com
Updated: 2023-09-24ImprintContactTerms & conditionsPrivacy & CookiesUpdatesSitemapFacebookLinkedinTwitterStatistics©2020-2024 Heino Cunze-Fischer