Format Numbers with a Comma in SQLite

SQLite has a printf() function or format() function that allows us to format numbers according to a format string.

As from SQLite 3.18.0, it accepts a comma flag, which enables us to have comma separators at the thousands marks for integers.

Further work can be done to get it working with real/floating point numbers.

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

7 Options for Enabling Pipes (||) as the Concatenation Operator in MariaDB

By default, two pipe characters (||) are treated as a logical OR operator in MariaDB. However, you can change this behaviour if you like.

You can update your sql_mode to include the PIPES_AS_CONCAT option, in which case two pipes will be treated as a concatenation operator.

There are quite a few ways to add this option to your sql_mode. You can add it explicitly. Or you can set your sql_mode to an option that sets it implicitly.

I run through these options below.

Read more