Join the SingleStore Community Today
Get expert advice, develop skills, and connect with others.

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     |
+------------+