代码如下:
select * from table1 order by dbms_random.value();
代码如下:
-- 下面的查询语句效率高,不要使用 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()
原文链接:https://www.f2er.com/oracle/65410.htmlFROM Northwind Orders
ORDER BY NEWID()
SELECT TOP 10 *
FROM Northwind Orders
ORDER BY NEWID()