> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# database

> Returns the name of the current database.

Returns the name of the current database. If no database is selected, an empty value is returned.

## Syntax

```Haskell theme={null}
database()
```

## Parameters

This function does not require parameters.

## Return value

Returns the name of the current database as a string.

## Examples

```sql theme={null}
-- Select a destination database.
use db_test

-- Query the name of the current database.
select database();
+------------+
| DATABASE() |
+------------+
| db_test    |
+------------+
```

## See also

[USE](/documents/4.2/sql-reference/sql-statements/Database/USE.md): Switches to a destination database.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.