Overview

The current_database() is a session information function that returns the current database’s name.

Syntax

The syntax forcurrent_database() function is as follows:

SELECT current_database();

Example

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

SELECT current_database();

By executing the query above, we will get the following output:

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