create table temp as select * from tableName; truncate table tableName; insert into tableName select * from temp order by random();