select a.* from ( select a.*,rand(12345) as random from tripdata a ) a where random between 0 and 0.2;
a.country       a.city  a.visitors      a.random
阿联酋  迪拜    268     0.3618031071604718
阿联酋  迪拜    108     0.932993485288541
澳大利亚        墨尔本  230     0.8330913489710237
澳大利亚        墨尔本  188     0.32647575623792624
澳大利亚        堪培拉  378     0.2355237906476252
select distinct a.* from tripdata a order by rand(12345) limit 5;
country       city  visitors
阿联酋  阿布扎比        157
阿联酋  阿布扎比        137
阿联酋  迪拜    144
阿联酋  阿布扎比        227
澳大利亚        堪培拉  240
https://www.jianshu.com/p/2b73e7c53355
原文:https://www.cnblogs.com/Allen-rg/p/10433000.html