:=
This page is part of MariaDB's Documentation.
The parent of this page is: SQL Operators for MariaDB Xpand
Topics on this page:
Overview
Assign value.
USAGE
variable := value
Value Name | Description |
---|---|
| The variable that receives the value |
| The value to assign |
DETAILS
The :=
operator assigns a value to a variable.
A variable name is introduced with one preceding @
character to indicate that it is a session variable.
A variable name is introduced with two preceding @
characters to indicate that it is a global variable.
EXAMPLES
SELECT @a := (@b := 5) + 2, @b;
+---------------------+------+
| @a := (@b := 5) + 2 | @b |
+---------------------+------+
| 7 | 5 |
+---------------------+------+
SELECT @b + @a := 1, @a;
+--------------+----+
| @b + @a := 1 | @a |
+--------------+----+
| 6 | 1 |
+--------------+----+