数据库随机取n条记录
SQL Server
(
SELECT * FROM 表名
ORDER BY DBMS_RANDOM.VALUE
)
WHERE ROWNUM < = N;
SELECT TOP N * FROM 表名 ORDER BY NEWID()
My SQL
SELECT * FROM 表名 ORDER BY RAND() LIMIT N
Oracle
SELECT * FROM
(
SELECT * FROM 表名
ORDER BY DBMS_RANDOM.VALUE
)
WHERE ROWNUM < = N;