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()