RAND function in mysql

By | January 18, 2014

if you give RAND() in the query it will generate random number between 0 and 1

Eg:Select RAND() from mydoubts_data;

————–
RAND()
————-
0.454545
————

select * from mydoubts_data;

——————–
name | salary |
——————–
vasanthan | 2000
| John | 3000
| Kiran | 6800
| Raju | 5706

select * from mydoubts_data order by RAND();

——————–
name | salary |
——————–
| Kiran | 6800
| John | 3000
| vasanthan | 2000
| Raju | 5706

it will change the order of data ,query result will be in a random order.