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.

Read more

How 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.

Read more

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.

Read more

MariaDB ROW_COUNT() Explained

In MariaDB, ROW_COUNT() is a built-in function that returns the number of rows updated, inserted or deleted by the preceding statement.

The value returned by ROW_COUNT() is the same as the row count that the mysql client displays and the value from the mysql_affected_rows() C API function.

Read more

MariaDB LAST_INSERT_ID() Explained

In MariaDB, LAST_INSERT_ID() is a built-in function that returns the first automatically generated value successfully inserted for an AUTO_INCREMENT column as a result of the most recently executed INSERT statement.

It can also be called with an argument, in which case, it returns the value of the expression and the next call to LAST_INSERT_ID() will return the same value.

Read more