Outdated Version

You are viewing an older version of this section. View current production version.

DATABASE

Returns the name of the currently selected database. If no database is selected, then this function returns NULL.

Syntax

DATABASE()

Return Type

String.

Example

SELECT DATABASE();
****
+------------+
| DATABASE() |
+------------+
| NULL       |
+------------+
USE trades;

SELECT DATABASE();
****
+------------+
| DATABASE() |
+------------+
| trades     |
+------------+