mysql 随机取一条数据时间:2020-12-16 15:12:35第一种办法: select * from 表名 order by rand( ) limit 1; //此处的1就是取出数据的条数 第二种办法 SELECT * FROM user WHERE userId >= ((SELECT MAX(userId) FROM user )-(SELECT MIN(userId) FROM user )) * RAND() + (SELECT MIN(userId) FROM user ) LIMIT 5