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

几种数据库如何读取前N条记录

上一篇:Linux中Hibernate连接不上MySql,但是在外网都能访问


下一篇:CodeIgniter 更新和插入数据库时的进行数据转义