e default database is the database that the routine is associated
with, which is not necessarily the same as the database that is the default in
the calling context.

SCHEMA() is a synonym for DATABASE().

To select a default database, the USE statement can be run. Another way to set
the default database is specifying its name at mariadb command line client
startup.

Examples
--------

SELECT DATABASE();
+------------+
| DATABASE() |
+------------+
| NULL       |
+------------+

USE test;
Database changed

SELECT DATABASE();
+------------+
| DATABASE() |
+------------+
| test       |
+------------+

URL: https://mariadb.com/kb/en/database/https://mariadb.com/kb/en/database/