Link Search Menu Expand Document

GEN_RANDOM_UUID

Returns a version 4 universally unique identifier (UUID) according to RFC-4122. This function accepts no arguments.

Syntax

GEN_RANDOM_UUID()

Example

The example below outputs the result of GEN_RANDOM_UUID as session_id.

SELECT
	GEN_RANDOM_UUID() AS session_id;

Returns:

+--------------------------------------+
|              session_id              |
+--------------------------------------+
| 08a95d43-2f01-4227-a111-de4f8ad205a0 |
+--------------------------------------+