SQL RAND Function
The SQL RAND() function is used to generate some random numbers at run time. Here is the syntax:
RAND(<numeric_expression>)
Here is an example of using SQL RAND() function
SELECT RAND() AS random_value
And the output at my runtime is
random_value --------------- 0.4179369289595
The output shows that you can only get the random value with range of 0 and 1. If you want to number outside that range you can multiply the output of the function by the range factor and then using ROUND function to get the result. Here is an example of getting the random value between 0 and 100:
SELECT ROUND((RAND()* 100),0) random_value_0_to_100
and the output at my runtime is
random_value_0_to_100
---------------------
56