Below are 4 functions that enable you to return the minutes portion from a time value in MariaDB.
Continue readingMariaDB JSON_OBJECTAGG() Explained
In MariaDB, JSON_OBJECTAGG()
is a built-in function that returns a JSON object containing key-value pairs, based on its two arguments.
MariaDB JSON_ARRAY_APPEND() Explained
In MariaDB, JSON_ARRAY_APPEND()
is a built-in function that appends values to the end of the specified array/s within a JSON document, and returns the result.
MariaDB JSON_ARRAY_INSERT() Explained
In MariaDB, JSON_ARRAY_INSERT()
is a built-in function that inserts a value into a JSON document and returns the result.
MariaDB JSON_OBJECT() Explained
In MariaDB, JSON_OBJECT()
is a built-in function that returns a JSON object containing the key/value pairs provided as arguments.
MariaDB JSON_ARRAYAGG() Explained
In MariaDB, JSON_ARRAYAGG()
is a built-in function that returns a JSON array containing an element for each value in a given set of JSON or SQL values.
The function acts on a column or an expression that evaluates to a single value. It enables you to aggregate a result set as a single JSON array. Each row of the result set ends up as a single element in the array.
Continue readingHow to Add AM/PM to a Time or Datetime Value in MariaDB
MariaDB includes many functions that allow you to return time and datetime values in a variety of formats.
Two functions allow you to format the time portion using a 12 hour clock, with the AM/PM designator are DATE_FORMAT()
and TIME_FORMAT()
.
There are many format specifiers that can be used with these functions, but only a couple that return the AM/PM designator.
Continue readingMariaDB JSON_ARRAY() Explained
In MariaDB, JSON_ARRAY()
is a built-in function that returns a JSON array containing the specified values, provided as arguments.
MariaDB CURRENT_ROLE() Explained
In MariaDB, CURRENT_ROLE()
is a built-in function that returns the current role name. The current role determines your access privileges.
The output of SELECT CURRENT_ROLE
is equivalent to the contents of the information_schema.ENABLED_ROLES
table.
How to Subtract a Year from a Date in MariaDB
MariaDB provides several ways to perform arithmetic on dates. This includes adding or subtracting a year (or many years) from a given date.
Here’s an example of subtracting a year from a date in MariaDB.
Continue reading