随机获取10条记录

前端之家收集整理的这篇文章主要介绍了随机获取10条记录前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
MysqL:    select * from tablename order by rand() limit 10 
sqlserver:    select top 10 * from tablename order by NEWID()

sqlite:Select * From tablename order by random(*) limit 10

Oracle:

SELECT column FROM 
( SELECT column FROM table 
ORDER BY dbms_random.value ) 
WHERE rownum <= 10

Postgresql:

SELECT column FROM table 
ORDER BY RANDOM() 
LIMIT 10
原文链接:https://www.f2er.com/postgresql/196590.html

猜你在找的Postgre SQL相关文章