Oracle查询结果集,随机排序
select * from table1 order by dbms_random.value();
MySQL随机查询出一条记录:
-- 下面的查询语句效率高,不要使用 SELECT * FROM table1 ORDER BY rand() LIMIT 1 来查询 SELECT * FROM table1 WHERE id=(SELECT id FROM table1 ORDER BY rand() LIMIT 1)
查询结果集,随机排序
SELECT * FROM table1 ORDER BY rand()
MS SQL Server
SELECT *
FROM Northwind Orders
ORDER BY NEWID()
SELECT TOP 10 *
FROM Northwind Orders
ORDER BY NEWID()