What does ||
do in SQL?
SELECT 'a' || ',' || 'b' AS letter
What does ||
do in SQL?
SELECT 'a' || ',' || 'b' AS letter
||
represents string concatenation. Unfortunately, string concatenation is not completely portable across all sql dialects:
||
(infix operator)concat
( vararg function ). caution: ||
means 'logical or' (It's configurable, however; thanks to @hvd for pointing that out)||
(infix operator), concat
( caution: function of arity 2 only ! )||
(infix operator)+
(infix operator), concat
( vararg function )||
(infix operator)hopefully the confusion is complete ...
||
as logical OR by default, because MariaDB is a fork of MySQL. They have both changed enough since the fork that they should be considered different products, but they still share this behavior. –
Priggish SELECT 'a' || ',' || 'b' AS letter will combine a letter. The result become 'a,b'
||
operator concatenates strings –
Term 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?
It's a concatenation operator. So you would get 'a,b' from that.
I think ||
will work on most RDBMS's. SQL Server requires the +
operator (thanks to HVD for setting me straight!).
||
, and requires +
. –
Godfry In Oracle, SQLite3, and MySQL, it concatenates strings. Please see the Oracle documentation. The MySQL documentation.
Also, it's part of ANSI SQL, but read this for more information.
in oracle its a shortcut for concatenate
http://docs.oracle.com/cd/B19306_01/server.102/b14200/operators003.htm
© 2022 - 2024 — McMap. All rights reserved.
... WHERE Name LIKE '%' || :searched || '%'...
– Trihydric