在SQL Server中可以通過以下方式來取得隨機的前N條記錄
select top N * from Table_Name order by newid()
在Access中隨機抽取的方法
SELECT top N * FROM Table_Name ORDER BY Rnd(id)
SELECT top N * FROM Table_Name ORDER BY Rnd(Len(UserName))
在MySql中隨機抽取的方法
Select * From Table_Name Order By rand() Limit N
Oracle
select * from ta order by dbms_random
From:http://tw.wingwit.com/Article/program/Oracle/201311/17319.html