How to Update a Field Value With a Random String in MySql

If you are looking for trying to updating a field value with a random string: updating it in the the database is an option.

This may infact be faster than (generating and) setting it on your application’s logic.

UPDATE <tablename> SET <fieldname> = SUBSTRING(MD5(RAND()) FROM 1 FOR 10);

The above query generates a 10 character long string and updates the field name with it.

Refer

comments powered by Disqus