VALUES()

Overview

Used in the UPDATE clause of an INSERT... ON DUPLICATE KEY UPDATE statement to refer to a column's inserted value.

USAGE

VALUES(column_name)

Argument Name

Description

column_name

A column name in the INSERT

DETAILS

VALUES() is a helper function that returns a column's to-be-inserted value when called in the UPDATE clause of an INSERT... ON DUPLICATE KEY UPDATE statement.

Not to be confused with the VALUES syntax in an INSERT statement that is used to indicate that one or more rows of literal data follows.

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

CREATE TABLE t (
  a INT PRIMARY KEY,
  b INT,
  c INT
);

Note that this is not the VALUES() function:

INSERT INTO t VALUES (1,2,3), (4,5,6);

This is the VALUES() function:

INSERT INTO t SET a = 1, b = 7, c = 8
  ON DUPLICATE KEY UPDATE c = c + VALUES(c);
SELECT * FROM t;
+---+------+------+
| a | b    | c    |
+---+------+------+
| 1 |    2 |   11 |
| 4 |    5 |    6 |
+---+------+------+

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