[英]"a"+'b'+"c",What does two double quotes and one single quote combination mean in mysql
For example例如
SELECT "hello"'jacky'"hi" as value from dual;
the result is hellojackyhi
结果是
hellojackyhi
But it confuse me that the use of this pattern "a"+'b'+"c"
.但让我感到困惑的是使用这种模式
"a"+'b'+"c"
。
What does this pattern exactly mean?It's a use of double quotes and single quote, is it mean I can always combine 3 string using this pattern "a"+'b'+"c"
?这个模式到底是什么意思?它是双引号和单引号的使用,是不是意味着我总是可以使用这个模式组合 3 个字符串
"a"+'b'+"c"
?
MySQL has a "feature" where it concatenates strings that are adjacent (and separated by a space): MySQL 有一个“功能”,它连接相邻的字符串(并用空格分隔):
select 'a' 'b' 'c'
---> abc
This works for both single quotes and double quotes.这适用于单引号和双引号。 Of course, double quotes might also be a column name.
当然,双引号也可能是列名。
So, this is a short-cut for string concatenation.因此,这是字符串连接的捷径。 I strongly recommend that you use
CONCAT()
instead, so the intention is clear.我强烈建议您改用
CONCAT()
,这样意图CONCAT()
明确了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.