几种数据库如何读取前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

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。