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

# last_query_id

> Obtains the ID of the most recently executed query in the current session.

Obtains the ID of the most recently executed query in the current session.

## Syntax

```Haskell theme={null}
VARCHAR last_query_id();
```

## Parameters

None

## Return value

Returns a value of the VARCHAR type.

## Examples

```Plain Text theme={null}
mysql> select last_query_id();
+--------------------------------------+
| last_query_id()                      |
+--------------------------------------+
| 7c1d8d68-bbec-11ec-af65-00163e1e238f |
+--------------------------------------+
1 row in set (0.00 sec)
```

## Keywords

LAST\_QUERY\_ID


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