In MySQL, the FORMAT()
function returns a number formatted to a specified number of decimal places.
It includes group separators and a decimal separator where applicable.
Continue readingDatabase Management Systems
In MySQL, the FORMAT()
function returns a number formatted to a specified number of decimal places.
It includes group separators and a decimal separator where applicable.
Continue readingSQL Server provides us with a quick and easy way to format numbers with commas inserted at the relevant place. For example, 1234.56 can become 1,234.56. Or it can become 1.234,56, if that’s the locale that you’re using.
Continue readingBelow are examples that demonstrate how to use SQL to return the short month name from a date in the major RDBMSs.
Continue readingHere are two ways to concatenate strings and numbers in MariaDB:
CONCAT()
function, which concatenates its arguments.||
), which concatenates its operands.Below are examples of each.
Continue readingSQLite 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.
Continue readingHere’s a list of units that can be used in MySQL datetime and interval functions.
Continue readingSQLite has a PRINTF()
function (and now a FORMAT()
function) that allows us to format a number based on a format string. For example, we can use this to format the number to a given number of decimal places, plus add a currency symbol to it.
In PostgreSQL, the CONCAT_WS()
function concatenates two or more strings, placing a separator between each one. The separator is specified by the first argument.
There are a couple of approaches we can use to concatenate strings and numbers in MySQL.
CONCAT()
function, which concatenates its arguments.||
), which concatenates its operands.Below are examples of each.
Continue readingOracle Database has the TO_CHAR(datetime)
function that enables us to get various date parts from a datetime value.
There’s also the EXTRACT(datetime)
function that extracts a specific datetime unit (e.g. day, month, year, etc).