从数据库表中随机获取N条记录的SQL语句

Oracle:

       select * from (select * from tableName order by dbms_random.value) where rownum < N

MS SQLServer:

       select top N * from tableName order by newid()

My SQL:

       select * from tableName order by rand() limit N

原文:https://blog.csdn.net/senton/article/details/4404101

原文地址:https://www.cnblogs.com/1906859953Lucas/p/10436620.html