What does SQL Select symbol || mean?
Solution 1:
||
represents string concatenation. Unfortunately, string concatenation is not completely portable across all sql dialects:
- ansi sql:
||
(infix operator) - mysql:
concat
( vararg function ). caution:||
means 'logical or' (It's configurable, however; thanks to @hvd for pointing that out) - oracle:
||
(infix operator),concat
( caution: function of arity 2 only ! ) - postgres:
||
(infix operator) - sql server:
+
(infix operator),concat
( vararg function ) - sqlite:
||
(infix operator)
hopefully the confusion is complete ...
Solution 2:
SELECT 'a' || ',' || 'b' AS letter will combine a letter. The result become 'a,b'
Solution 3:
It is a concat statement. It will concatenate the two strings.
Here is a helpful post!
What is the difference between "||" operator and concat function in Oracle?