SUB()

Overview

Returns the second argument subtracted from the first argument.

USAGE

SUB([number,] number)

Argument Name

Description

number

Two numbers to subtract or one number to negate

DETAILS

SUB() is a mathematical function that returns the result of subtracting the second argument from the first argument.

If the optional first argument is not provided, it defaults to 0, resulting in a negated numeric value.

A NULL is returned if either argument is NULL.

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

SELECT SUB(59, 17), SUB(99);
+-------------+---------+
| SUB(59, 17) | SUB(99) |
+-------------+---------+
|          42 |     -99 |
+-------------+---------+

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