MariaDB includes two built-in functions that allow us to get the ASCII code from a given character.
Continue readingCategory: MariaDB
4 Ways to Check a Column’s Data Type in MariaDB
MariaDB provides multiple ways of returning the data type of a column. Here are four ways to get the data type of a given column in MariaDB.
Continue readingSubtract Seconds from a Datetime Value in MariaDB
Here are some options for subtracting one or more seconds from a datetime expression in MariaDB.
Continue readingHow to List all Stored Procedures in MariaDB
In MariaDB, we can use the SHOW PROCEDURE STATUS
command to return a list of stored procedures.
We can also query the information_schema.routines
table to do the same thing.
Return Random Rows from a Table in MariaDB
Here’s a quick way to return random rows from a table in MariaDB.
Continue readingHow to Format Numbers with Commas in SQL
Most of the major RDBMSs have functions that enable us to format numbers with commas as either the group separator, or the decimal separator.
Some RDBMSs also output certain numeric data types with commas in the relevant place.
Below are examples of formatting numbers with commas in some of the more popular DBMSs.
Continue readingDROP TABLE IF EXISTS in MariaDB
In MariaDB, we can use the IF EXISTS
clause of the DROP TABLE
statement to check whether the table exists or not before dropping it.
Format a Number as a Percentage in SQL
There are several ways to format a number as a percentage in SQL, depending on the DBMS being used.
Here are examples of adding a percent sign to a number in some of the most popular DBMSs.
Continue readingCOUNT() Function in MariaDB
In MariaDB, the COUNT()
aggregate function returns a count of the number of non-NULL values of an expression in the rows retrieved by a SELECT
statement.
AVG() Function in MariaDB
In MariaDB, the AVG()
function returns the average value of the given expression.
The DISTINCT
option can be used to return the average of the distinct values (i.e. remove duplicates before calculating the average).
NULL
values are ignored.