In MariaDB, INSERT()
is a built-in string function that allows you to insert a substring into another string.
Author: Ian
How UNHEX() Works in MariaDB
In MariaDB, UNHEX()
is a built-in string function that performs the inverse operation of the HEX()
function.
Whereas, the HEX()
function returns a hexadecimal representation of a given string, the UNHEX()
function returns the string representation of a given hexadecimal value.
Specifically, UNHEX()
interprets each pair of hexadecimal digits in its argument as a number, and then converts it to the character represented by the number.
The result is returned as a binary string.
Continue readingHow HEX() Works in MariaDB
In MariaDB, HEX()
is a built-in string function that returns a hexadecimal string representation of its argument.
How FORMAT() Works in MariaDB
In MariaDB, FORMAT()
is a built-in string function that formats and returns the given number as a string.
It requires two arguments, and accepts an optional third argument. The first is the number you want to format, the second is the decimal position, and the (optional) third is the locale.
Continue readingHow FROM_BASE64() Works in MariaDB
In MariaDB, FROM_BASE64()
is a built-in string function that decodes the given base-64 encoded string.
It returns the result as a binary string.
Continue readingHow TO_BASE64() Works in MariaDB
In MariaDB, TO_BASE64()
is a built-in string function that converts its string argument to its base-64 encoded form.
The TO_BASE64()
function returns its result as a character string in the connection character set and collation (see how to get your connection’s collation).
3 Ways to Show the Collation for your Connection in MariaDB
When you run a query against a MariaDB database, MariaDB uses a bunch of system variables to determine which character set and collation to use whenever queries are run. If the client uses a different character set to the server, then MariaDB can translate it into an appropriate character set and collation.
When sending the query results back to the client, MariaDB can translate these results back to a different character set altogether if required. MariaDB uses system variables to determine which character sets and collations to use at each of these steps.
Here are three ways to show the connection collation in MariaDB.
Continue readingConvert a Month Number to the Month Name in SQL Server (T-SQL)
You can use the T-SQL code below to convert a month number to its corresponding name in SQL Server.
This is for times where you don’t actually have the full date – when all you have is the month number. If you do have the date, then here’s how to get the month name from a date.
Continue readingHow EXPORT_SET() Works in MariaDB
In MariaDB, EXPORT_SET()
is a built-in string function that returns a string that reflects the bits in the specified value. For every bit set in the specified value, you get an “on” string and for every bit not set in the value, you get an “off” string.
It accepts a minimum of three arguments, plus two optional arguments.
Continue readingHow FIND_IN_SET() Works in MariaDB
In MariaDB, FIND_IN_SET()
is a built-in string function that returns the index position where the given pattern occurs in the specified string list.
It accepts two arguments. The first is the pattern you want to search for. The second argument is a string containing comma-separated values for which to match the pattern against.
Continue reading