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

How to Format Numbers as Currency in MySQL

Some DBMSs provide us with the ability to format a number as a currency by providing a format specifier for the currency symbol. Providing such a format specifier allows the DBMS to return the appropriate currency symbol for the locale.

MySQL doesn’t have a currency format specifier, and so we need to do a bit of extra work if we want the currency symbol to be returned.

Read more

How to Format Numbers in Oracle

In Oracle Database, you can format numbers in many ways.

For example, you can format a number as a currency, with commas and decimal points in the right place. You can specify leading zeros, you can add a fractional part – or remove it, if that’s what’s required.

Read more

4 Ways to Format a Number Without Decimals in Oracle

When using Oracle Database, you can use functions like TO_CHAR(number) to return numbers as a string. This enables you to format the number to have a specific number of decimal places – including no decimal places, if that’s what you want.

You can also use functions like ROUND(number) and TRUNC(number) to round or truncate the number to no decimal places.

There’s also the CAST() function that allows you to cast a data type as an integer, which effectively removes any decimal places.

Read more