Home  >  Article  >  Database  >  各个数据库中TOP10记录的查询方法

各个数据库中TOP10记录的查询方法

WBOY
WBOYOriginal
2016-06-07 16:53:332484browse

各个数据库中TOP10记录的查询方法Oracle数据库:select * from (select * from tab order by id desc) where rownum lt; 11;MyS

各个数据库中TOP10记录的查询方法

Oracle数据库:

select * from (select * from tab order by id desc) where rownum

MySQL数据库:

select * from tab order by id desc limit 0, 10;

(这里keyword limit startid,rownum是这样的:表示从startid + 1行开始,一共查询rownum条记录。

如,例子就是从第一行开始,,一共查询10行。)

MSSQL与Access数据库

select top 10 * from tab order by id desc

(这个大概是最常用的了, ^.^)

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn