Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does double bars (||) mean in SQL? [duplicate]

Tags:

sql

mysql

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?


In MySQL:
select "aaaaa" || '' || "bbbbb";

+--------------------------+ | "aaaaa" || '' || "bbbbb" | +--------------------------+ | 0 | +--------------------------+

like image 812
zer0uno Avatar asked May 28 '14 18:05

zer0uno


People also ask

What does double bar mean in SQL?

double bars are concatination: select 'hello' || ' ' || 'world' from dual; yields 'hello world' Follow this answer to receive notifications.

What do || mean in SQL?

The concatenation operator is a binary operator, whose syntax is shown in the general diagram for an SQL Expression. You can use the concatenation operator ( || ) to concatenate two expressions that evaluate to character data types or to numeric data types.

What does || mean in Oracle?

In Oracle, the double pipe ( || ) stands for string concatenation.

What is the use of '#' in SQL?

The pound sign # is used to prefix temporary tables and procedures. A single instance ( # ) refers to a temporary object that lives/dies with the current session while a double instance ( ## ) is a global object.


1 Answers

double bars are concatination:

select 'hello' || ' ' || 'world' from dual;

yields

'hello world'
like image 183
Andreas Avatar answered Oct 19 '22 03:10

Andreas