Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does SQL Select symbol || mean?

People also ask

What does || mean in SQL query?

Prerequisite: Basic Select statement, Insert into clause, SQL Create Clause, SQL Aliases. || or concatenation operator is use to link columns or character strings.

What is || in SQL Oracle?

|| Concatenates character strings and CLOB data. SELECT 'Name is ' || last_name FROM employees; The result of concatenating two character strings is another character string.

What does == in SQL mean?

The sql equal operator is used to check whether two expressions are equal or not. If it's equal, the condition will be true and will return matched records. Not Equal (!=) Operator. The sql not equal operator is used to check whether two expressions are equal or not.


|| 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 ...


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!).


SELECT 'a' || ',' || 'b' AS letter will combine a letter. The result become 'a,b'


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.