And another UUID function. This one also generates UUIDv7, just like the the one in the previous post , but this one is designed to work in PostgresSQL, instead of MySQL As before: either use this inline in your select statement, or convert it to a function.
Tag Archives: databases
UUIDv7 in MySQL
Similar to my previous post, this code generates a UUID of the new v7 type, which has a Unix-timestamp base. This keeps UUIDs sortable by creation-date, which is useful when using them as database keys, for example You can either use this inline in your select statement, or convert it to a function.
UUIDv4 in MySQL
Although MySQL has a UUID() function, it returns a version 1 UUID, which is time-based and has mostly been replaced by the completely random version 4. I recently needed a v4 in a query, and adapted this from some different options I found online: You can either use this inline in your select statement, or convert […]