数据库查询排序使用随机排序结果示例(Oracle/MySQL/MS SQL Server)
Oracle查询结果集,随机排序
select * from table1 order by dbms_random.value();
MySQL随机查询出一条记录:
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()