服务热线:13616026886

技术文档 欢迎使用技术文档,我们为你提供从新手到专业开发者的所有资源,你也可以通过它日益精进

位置:首页 > 技术文档 > 数据库技术 > Oracle技术 > Oracle开发 > 查看文档

教你在不同数据库环境下读取前n条记录数

【赛迪网-it技术报道】在不同数据库环境下读取前n条记录数:

1. oracle

select * from table1 where rownum<=n

2. informix

select first n * from table1 where 1=1

3. mysql

select * from table1 where 1=1 limit n

4. db2

select * row_number() over(order by col1 desc) as rownum where rownum<=n

或者

select column from table where 1=1 fetch first n rows only

5.sql server

select top n * from table1 where 1=1

or

set rowcount n select * from table1 where 1=1 set rowcount n1

6. sybase

set rowcount n select * from table1 where 1=1 set rowcount n1

7. foxpro

select * top n from table order by column

8. access

select top n * from table1 where 1=1

扫描关注微信公众号