Home > Database > Mysql Tutorial > body text

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

WBOY
Release: 2016-06-07 16:53:33
Original
2490 people have browsed it

各个数据库中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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template