Bug #72404 Randomize object
Submitted: 20 Apr 2014 10:07 Modified: 21 Apr 2014 19:59
Reporter: Jassim Rahma Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Data Types Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any

[20 Apr 2014 10:07] Jassim Rahma
Description:
I suggest the following improvement:

Introduce Randomize to provide a random number, charater or mix with an option to make it unique in a column within a table. Also allow it to be a default value for a column.

How to repeat:
it's a suggestion
[21 Apr 2014 18:06] Sveta Smirnova
Thank you for the report.

Isn't function RAND() does what you request?

mysql> select rand(8);
+---------------------+
| rand(8)             |
+---------------------+
| 0.15668530311126755 |
+---------------------+
1 row in set (0.00 sec)

mysql> select rand(8);
+---------------------+
| rand(8)             |
+---------------------+
| 0.15668530311126755 |
+---------------------+
1 row in set (0.00 sec)

mysql> select rand();
+---------------------+
| rand()              |
+---------------------+
| 0.06812610204157056 |
+---------------------+
1 row in set (0.00 sec)

mysql> select rand();
+--------------------+
| rand()             |
+--------------------+
| 0.6383920327186511 |
+--------------------+
1 row in set (0.00 sec)

If not: please explain what you mean in better details.
[21 Apr 2014 18:56] Jassim Rahma
Thanks for your reply.

It's not what I asked for.

as mentioned it should allow alpha-numeric random objects.

and it should be allowed as a default value for a column with an option to make it unique for all rows or not.
[21 Apr 2014 19:15] Sveta Smirnova
Thank you for the feedback.

So you want a function which generates unique alpha-numeric, but random value which can be used as a default value for a column. Something like CREATE TABLE test(f1 VARCHAR(255) DEFAULT RANDOMIZE).

Verified as feature request.
[21 Apr 2014 19:59] Jassim Rahma
it should accept ANY options

for example

RANDOMIZE(0-9) only 0 to 9

RANDOMIZE(a-z) only a to z in small caps

RANDOMIZE(A-Z) only A-Z in capital letters

RANDOMIZE(A-Z,a-z,0-9) includes A to Z in capital, a to z in small caps and 0 to 9

RANDOMIZE(A-Z,a-z,0-9,?,!,@) includes A to Z in capital, a to z in small caps, 0 to 9, question mark, exclamation mark and at sign