Overview

The CURRENT_DATABASE() returns the current database’s name.

Syntax

The following syntax describes CURRENT_DATABASE() function.

SELECT CURRENT_DATABASE();

It does not require any argument to operate.

Example

In the following example, we will obtain the database name to which we are currently connected. 

SELECT CURRENT_DATABASE();

The function will return the result with the database name:

+------------+
| f          |
+------------+
| Oxla       |
+------------+