MariaDB Tutorial MariaDB Advanced MariaDB Database Account Management MariaDB References

MariaDB DATABASE() Function



The MariaDB DATABASE() function returns the name of the current (default) database. This function uses the UTF8 character set. It returns NULL, if there is no default database.

Syntax

DATABASE()

Parameters

No parameter is required.

Return Value

Returns the name of the current (default) database.

Example:

The example below shows the usage of DATABASE() function.

SELECT DATABASE();

The above query will return name of the current (default) database. If the current (default) database is SQLExample, the above query will return the string 'SQLExample'.

SELECT DATABASE();
Result: 'SQLExample'

❮ MariaDB Functions

5