ISNULL()

Overview

Returns a boolean that indicates if the argument is NULL.

USAGE

ISNULL(value)

Argument Name

Description

value

The value to be tested

DETAILS

ISNULL() returns a boolean indicating if the expr evaluates to NULL.

The return value is 1 if the function argument evaluates to NULL, otherwise it returns 0.

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

With Literal Values

In the following examples, ISNULL() is called with literal values:

SELECT ISNULL(0+1);
+-------------+
| ISNULL(0+1) |
+-------------+
|           0 |
+-------------+
SELECT ISNULL(1/0);
+-------------+
| ISNULL(1/0) |
+-------------+
|           1 |
+-------------+

Example Schema and Data

The remaining examples are based on the example table contacts:

CREATE TABLE contacts (
  first_name VARCHAR(25),
  last_name VARCHAR(25),
  email VARCHAR(25),
  new_contact boolean
);
INSERT INTO contacts VALUES
  ("John","Smith","john.smith@example.com",false),
  (NULL,"Smith","jane.smith@example.com",false),
  ("Sally","Smith",NULL,NULL),
  (NULL,NULL,NULL,NULL);

Per-row Evaluation

SELECT ISNULL(first_name) AS first_name,
       ISNULL(last_name) AS last_name,
       ISNULL(email) AS email,
       ISNULL(new_contact) AS new_contact
 FROM contacts;
+------------+-----------+-------+-------------+
| first_name | last_name | email | new_contact |
+------------+-----------+-------+-------------+
|          0 |         0 |     0 |           0 |
|          1 |         0 |     0 |           0 |
|          0 |         0 |     1 |           1 |
|          1 |         1 |     1 |           1 |
+------------+-----------+-------+-------------+

ERROR HANDLING

FEATURE INTERACTION

RESPONSES

DIAGNOSIS

ISO 9075:2016

CHANGE HISTORY

Release Series

History

23.09

  • Present starting in MariaDB Xpand 23.09.1.

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

EXTERNAL REFERENCES