select top语句多个数据库用法

发布时间:2019-10-19编辑:脚本学堂
select top语句的用法举例子,包括oracel、sql server、mysql数据库中select top语句的用法。

select top语句

1,oracle数据库
 

select * from table1 where rownum<=n

2,infomix数据库
 

select first n * from table1

3,db2数据库
 

select * row_number() over(order by col1 desc) as rownum where rownum<=n
--或
select column from table fetch first n rows only

4,sql server数据库
 

select top n * from table1

5,sybase数据库
 

set rowcount n
go
select * from table1

6,mysql/ target=_blank class=infotextkey>mysql数据库
 

select * from table1 limit n

7,foxpro数据库
 

select * top n from table order by column