MySQL,@@是什么意思? [英] MySQL, what does @@ mean?
问题描述
我正在阅读此页面上的MySQL文档, http: //dev.mysql.com/doc/refman/5.1/zh-CN/set-statement.html 它经常使用"@@",但没有定义"@@"的含义?
I am reading the MySQL documentation, on this page http://dev.mysql.com/doc/refman/5.1/en/set-statement.html it often uses "@@", but does not define what "@@" means?
另一个例子是变量名
mysql> select @@hostname;
+------------+
| @@hostname |
+------------+
| server1 |
+------------+
1 row in set (0.00 sec)
mysql> select @hostname;
+-----------+
| @hostname |
+-----------+
| NULL |
+-----------+
1 row in set (0.00 sec)
@ vs @@是什么?
What is @ vs @@?
推荐答案
@@-系统可用
@@用于系统变量.使用带有@@的不同后缀,您可以获取系统变量的会话值或全局值.
@@ is used for system variables. Using different suffix with @@, you can get either session or global value of the system variable.
当在表达式中将系统变量引用为@@ var_name时(即,当您不指定@@ global.或@@ session.时),MySQL返回会话值(如果存在),否则返回全局值. (这与SET @@ var_name = value不同,后者始终引用会话值.)
When you refer to a system variable in an expression as @@var_name (that is, when you do not specify @@global. or @@session.), MySQL returns the session value if it exists and the global value otherwise. (This differs from SET @@var_name = value, which always refers to the session value.)
@-用户定义的变量
而@用于用户定义的变量.
while @ is used for user defined variables.
更多详细信息
在链接上有更多详细信息- http ://dev.mysql.com/doc/refman/5.1/en/set-statement.html
There are more details given to it on the link - http://dev.mysql.com/doc/refman/5.1/en/set-statement.html
这篇关于MySQL,@@是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!