Person表的数据如下:
随机获取表中1条数据:
1 SELECT *
2
3 FROM person
4
5 ORDER BY RAND()limit 1;
执行结果:
随机获取表中2条数据:
1 1 SELECT *
2 2
3 3 FROM person
4 4
5 5 ORDER BY RAND()limit 2;
执行结果:
Person表的数据如下:
随机获取表中1条数据:
1 SELECT *
2
3 FROM person
4
5 ORDER BY RAND()limit 1;
执行结果:
随机获取表中2条数据:
1 1 SELECT *
2 2
3 3 FROM person
4 4
5 5 ORDER BY RAND()limit 2;
执行结果: