数据库随机查询数据语句-Oracle-MySQL-SQL Server

2021-03-20 19:11 阅读:1753

Oracle:

select * from (select * from table_name order by dbms_random.random()) where rownum <=10

MySQL:

SELECT * FROM TABLE_NAME  ORDER BY  RAND() LIMIT 10

ThinkPHP:
Db::table('table_name')->orderRaw("RAND()")->limit(10)->select();

SQL Server:

SELECT TOP 10 * FROM TABLE_NAME ORDER BY NEWID()

{{commentTotal}} 条评论

{{item.nickname}}
{{item.create_date}}
{{item.content}}
- 上拉或点击加载更多 -
- 加载中 -
- 没有更多了 -
- 本文链接 -