数据库 随机 提取 N条记录
随机取出n条记录:
mysql:
Select * From tablename order By rand() Limit n
SqlServer:
select top n * from tablename order by newid()
Access:
Select top n * FROM tablename orDER BY Rnd(id)
Oracle:
Select * from (select * from tablename order by sys_guid()) where rownum < n Select * from (select * from tablename order by dbms_random.value) where rownum < n
DB2:
Select * from tablename order by rand() fetch first n rows only