sql - MySQL - rand from the defined values -
i'm trying insert random values tables. don't want make new values totally random (like eg: random numbers or characters),i want take random value set of values defined earlier. example: defined values: xyz, abc, edf random value: abc
i programming languages it's easy, in sql don't know, how store defined values , how take random value.
put random values in table.
then, can insert them 1 @ time doing:
insert tables(val) select val randomtable order rand() limit 1
the order rand() limit 1
chooses random value list.
Comments
Post a Comment