MySQL 双杠 (||) 在 SQL 中是什么意思?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23919378/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What does double bars (||) mean in SQL?
提问by zer0uno
I'm trying to understand the following query:
select count(distinct Name || '' || Surname) from PEOPLE;
What does the double bars mean? What does this query do?
我试图理解以下查询:
select count(distinct Name || '' || Surname) from PEOPLE;
双条是什么意思?这个查询有什么作用?
In MySQL:select "aaaaa" || '' || "bbbbb";
在 MySQL 中:select "aaaaa" || '' || "bbbbb";
+--------------------------+
| "aaaaa" || '' || "bbbbb" |
+--------------------------+
| 0 |
+--------------------------+
+--------------------------+
| "aaaaa" || '' || "bbbbb" |
+--------------------------+
| 0 |
+--------------------------+
回答by Andreas
double bars are concatination:
双条是串联的:
select 'hello' || ' ' || 'world' from dual;
yields
产量
'hello world'