Below are two options for returning a full list of stored procedures in MySQL.
Continue readingCategory: MySQL
JSON_VALUE() in MySQL
In MySQL, the JSON_VALUE()
function extracts a value from a JSON document at the specified path.
The function was introduced in MySQL 8.0.21.
Continue readingAdd Leading Zeros in SQL
Below are examples of adding a leading zero to a number in SQL, using various DBMSs.
Continue readingFormat a Number as a Percentage in MySQL
In MySQL, we can format a number as a percentage by concatenating the number with the percent sign.
The CONCAT()
function concatenates its arguments. We can pass the number as the first argument, and the percent sign as the second.
GROUP_CONCAT() Function in MySQL
MySQL has a GROUP_CONCAT()
function that enables us to return columns from a query as a delimited list.
It returns a string result with the concatenated non-NULL
values from a group.
Padding in SQL
Some RDBMSs provide an LPAD()
and RPAD()
function that enables us to left pad or right pad a string. Some functions also allow us to add leading or trailing zeros numbers.
Below are examples of applying SQL padding in some of the more popular RDBMSs.
Continue readingHow 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.
Continue readingHow to Get the Day, Month, and Year from a Date in SQL
Most of the major RDBMSs have functions that enable us to extract the day, month, and year from datetime values.
Some RDBMSs provide multiple ways to do this, and others are more limited. Below are examples of extracting the day, month, and year from date values in some of the most popular RDBMSs.
Continue readingFORMAT() Examples in MySQL
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 readingHow to Get the Short Month Name in SQL
Below are examples that demonstrate how to use SQL to return the short month name from a date in the major RDBMSs.
Continue reading