English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
To generate10strings, we can use the built-in functions 'rand()' and 'char()'. Here is the query to generate random10strings.
mysql> SELECT concat( - > char(round(rand()*25)+97), - > char(round(rand()*25)+97), - > char(round(rand()*25)+97), - > char(round(rand()*25)+97), - > char(round(rand()*25)+97), - > char(round(rand()*25)+97), - > char(round(rand()*25)+97), - > char(round(rand()*25)+97), - > char(round(rand()*25)+97), - > char(round(rand()*25)+97) - > )AS Random10CharacterString;
This is to display random10output of a string.
+-------------------------+ | Random10CharacterString | +-------------------------+ | duscikyspy | +-------------------------+ 1 row in set (0.00 sec)
Here is the query to generate uppercase random characters.
mysql> select concat( - > char(round(rand()*25)+65), - > char(round(rand()*25)+65), - > char(round(rand()*25)+65), - > char(round(rand()*25)+65), - > char(round(rand()*25)+65), - > char(round(rand()*25)+65), - > char(round(rand()*25)+65), - > char(round(rand()*25)+65), - > char(round(rand()*25)+65), - > char(round(rand()*25)+65) - > )AS Random10CharacterString;
Here is the output.
+-------------------------+ | Random10CharacterString | +-------------------------+ | WMWWVOIXPF | +-------------------------+ 1 row in set (0.00 sec)
The output above is displayed in uppercase with random characters.