PostgreSQL: How to generate a Random Token String?

In this post, I am providing different scripts to generate a random string in PostgreSQL.

Sometimes, we also require to generate a random token and any other random code in the Database System.

The PostgreSQL Provides a random() function to generate a random string with all the possible different numbers, character and symbol.
We can also use random() function with cryptography or encryption function to generate a fixed length binary string.

Generate a random string using MD5():

Generate a Capital Latter random string, size of 15.

Generate a Small Latter random string, size of 15.

Generate a Numerical random string, size of 15.

Generate a random string with all combinations, size of 15.

Anvesh Patel

Leave a Reply

Be the First to Comment!

Notify of
avatar
wpDiscuz