How to Concatenate Strings in SQL

Most of the major RDBMSs provide several options for concatenating two or more strings.

  • There’s the CONCAT() function, which concatenates its arguments.
  • There’s also a CONCAT_WS() that allows you to specify a separator that separates the concatenated strings.
  • And there’s also a string concatenation operator, which allows us to concatenate its operands.

Below are examples of each method.

Read more

Concatenate a String and a Number in MySQL

There are a couple of approaches we can use to concatenate strings and numbers in MySQL.

  • We can use the CONCAT() function, which concatenates its arguments.
  • We can use the pipe concatenation operator (||), which concatenates its operands.

Below are examples of each.

Read more