天天看點

翻譯:指派操作符(:=)(已送出到MariaDB官方手冊)

本文為mariadb官方手冊:指派操作符(:=)的譯文。

原文:https://mariadb.com/kb/en/assignment-operator/

我送出到MariaDB官方手冊的譯文:https://mariadb.com/kb/zh-cn/assignment-operator/

文法

var_name := expr
           

描述

該指派操作符用于為一個變量進行指派。操作符右邊的值将指派給操作符左邊的變量。

不像=操作符, := 操作符總是可以用來為變量指派。(譯者注:使用select語句指派時不能使用"="進行指派)。

該操作符可以為使用者自定義變量user-defined variables和本地變量local variables指派。

當要為多個變量指派相同的值時,可以考慮使用LAST_VALUE()函數。

示例

SELECT @x := 10;
+----------+
| @x := 10 |
+----------+
|       10 |
+----------+

SELECT @x, @y := @x;
+------+----------+
| @x   | @y := @x |
+------+----------+
|   10 |       10 |
+------+----------+
           

作者:駿馬金龍

出處:http://www.cnblogs.com/f-ck-need-u/

Linux運維交流群:921383787

Linux系列文章:https://www.junmajinlong.com/linux/index/

Shell系列文章:https://www.junmajinlong.com/shell/index/

網站架構系列文章:http://www.cnblogs.com/f-ck-need-u/p/7576137.html

MySQL/MariaDB系列文章:https://www.cnblogs.com/f-ck-need-u/p/7586194.html

Perl系列:https://www.junmajinlong.com/perl/index

Go系列:https://www.cnblogs.com/f-ck-need-u/p/9832538.html

Python系列:https://www.cnblogs.com/f-ck-need-u/p/9832640.html

Ruby系列:https://www.junmajinlong.com/ruby/index

作業系統系列:https://www.junmajinlong.com/os/index/

精通awk系列:https://www.junmajinlong.com/shell/awk/index