# DATABASE

Returns the name of the currently selected database.

If no database is selected, then this function returns `NULL`.

## Syntax

```sql
DATABASE()

```

## Return Type

String.

## Example

Without a database specified:

```sql
SELECT DATABASE();

```

```output

+------------+
| DATABASE() |
+------------+
| NULL       |
+------------+

```

With a database specified:

```sql
USE trades;

SELECT DATABASE();

```

```output

+------------+
| DATABASE() |
+------------+
| trades     |
+------------+

```

***

Modified at: February 24, 2023

Source: [/db/v9.1/reference/sql-reference/information-functions/database/](https://docs.singlestore.com/db/v9.1/reference/sql-reference/information-functions/database/)

(An index of the documentation is available at /llms.txt)
