1.oracle
select * from table1 where rownum <=10
2.informix
select frist 10 * from table1 where 1 = 1
3.DB2
select * row_number() over(order by col1 desc) as rownum where rownum <=10
4.SQL SERVER
select top 10 * from table1 where 1 = 1
or
set rowcount 10 select * from table1 where 1 = 1 set rowcount 100
5.sybase
set rowcount 10 select * from table1 where 1 = 1 set rowcount 100
6.mysql
select * from table1 where 1 = 1 limit 10 --取前10条记录
select * from table1 where 1 = 1 limit n,10 --从第n条开始,往后取10条记录,n从0开始.
7.foxpro
select * top 10 from table order by column
8.access
select top 10 * from table1 where 1 = 1
本文介绍了在不同类型的数据库中如何实现获取表中的前N条记录。覆盖了Oracle、Informix、DB2、SQL Server、Sybase、MySQL、FoxPro及Access等数据库系统的具体语法。
447

被折叠的 条评论
为什么被折叠?



