MariaDB JSON_COMPACT() Explained

In MariaDB, JSON_COMPACT() is a built-in function that removes all unnecessary spaces from a JSON document, so that it’s as short and compact as possible, and returns the result.

This can be handy for when you need to store JSON data in a database column, and you don’t want the JSON documents to use up any more space than is necessary.

For the opposite effect (i.e. to prettify a JSON document by adding indents and spreading it over multiple lines), use the JSON_DETAILED() function.

Read more

MariaDB JSON_CONTAINS_PATH() Explained

In MariaDB, JSON_CONTAINS_PATH() is a built-in function that indicates whether a given JSON document contains data at the specified path or paths.

It returns 1 if the document does contain data at the specified path/s, 0 if it doesn’t, and NULL if any of the arguments are NULL.

Read more

MariaDB JSON_CONTAINS() Explained

In MariaDB, JSON_CONTAINS() is a built-in function that allows you to find out whether a specified value is found in the given JSON document, or at a specific path within the document.

It returns 1 if it does contain the value, 0 if it doesn’t, and NULL if any of the arguments are NULL.

Read more

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

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