Below are two options for returning a full list of stored procedures in MySQL.
Continue readingCategory: Relational
Fix: “BACKUP LOG cannot be performed because there is no current database backup.” in SQL Server/SQL Edge
If you’re trying to back up the transaction logs in a SQL Server or SQL Edge database, but you get an error that states BACKUP LOG cannot be performed because there is no current database backup, you’ll need to perform at least one full backup of the database before you attempt to back up the transaction logs.
Continue readingSubtract Microseconds from a Datetime Value in MariaDB
Here are some options for subtracting one or more microseconds from a datetime expression in MariaDB.
Continue readingJSON_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 a Percent Sign to a Number in MariaDB
Below is a quick example of formatting a number as a percentage in MariaDB.
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.
2 Ways to Add a Percent Sign to a Number in SQLite
Here are two ways to format a number as a percentage in SQLite.
Continue readingINSTR() Equivalent in SQL Server
Many RDBMSs have an INSTR()
function that enables us to find a substring within a string. Some (such as MySQL and MariaDB) also have a LOCATE()
function and a POSITION()
function (also supported by PostgreSQL), that do a similar thing.
SQL Server doesn’t have an INSTR()
function. Nor does it have a LOCATE()
or POSITION()
function. But it does have the CHARINDEX()
function that does the same thing.
SQL Server also has the PATINDEX()
function, which does a similar job to CHARINDEX()
.
3 Ways to Separate the Year, Month, and Day from a Date in MariaDB
MariaDB has several functions that enable you to extract various date and time parts from date/time values. You can use these to separate each date/time component into its own column if required.
Below are three ways to extract the year, month, and day from a date value in MariaDB.
Continue reading