Function to generate a UUID string

string random_uuid()

The function random_uuid returns a randomly generated UUID, as a string of 36 characters. This function can be used to generate values for columns of type UUID in an INSERT or UPDATE SQL statements.

Example random_uuid Function

In this example, a randomly generated UUID is fetched using the random_uuid function.

sql-> CREATE TABLE myTable (id STRING AS UUID, name STRING, PRIMARY KEY (id));
Statement completed successfully

sql-> INSERT INTO myTable values(random_uuid(),"test1");
{"NumRowsInserted":1}
1 row returned
Statement completed successfully

sql-> select * from myTable;
{"id":"e755a045-8127-4ab3-b6b4-5906ca0bb1a5", "test1"}
1 row returned
Statement completed successfully