NOT

USAGE

NOT value

Value Name

Description

value

The value to negate

DETAILS

The NOT operator evaluates the following value as a truth value and then negates the value.

This means that any value expression that evaluates as logical true (a non-zero number) returns 0 (false) and any value that evaluates as logical false (zero) returns 1 (true).

A string is evaluated as a number, which parses any leading numerical content out of the string. A string with no numerical content is parsed as a zero.

A NULL is returned if the value expression is NULL.

The operator expression NOT x behaves in exactly the same manner as the function call NOT(x).

SYNONYMS

The following are synonyms for NOT:

  • !

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

SELECT NOT 42, NOT 0, NOT NULL;
+--------+-------+----------+
| NOT 42 | NOT 0 | NOT NULL |
+--------+-------+----------+
|      0 |     1 |     NULL |
+--------+-------+----------+
CREATE TABLE not_example (
  description VARCHAR(20),
  example INT
);
INSERT INTO not_example VALUES
  ('Everything', 42),
  ('Dalmations', 101),
  ('Agent', 99),
  ('B. Doz.', 13),
  ('CPU', 64);
SELECT *
FROM not_example
WHERE NOT (example = 101 OR description = 'B. Doz.');
+-------------+---------+
| description | example |
+-------------+---------+
| Everything  |      42 |
| Agent       |      99 |
| CPU         |      64 |
+-------------+---------+

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