1. 不同数据库中查询前N条记录
数据库类型 | SQL |
oracle | select * FROM table1 Where ROWNUM<=N; |
db2 |
select * ROW_NUMBER() OVER(ORDER BY COL1 DESC) AS ROWNUM Where ROWNUM<=N 或者 select COLUMN FROM TABLE FETCH FIRST N ROWS ONLY |
mysql | select * FROM table1 LIMIT N |
mssql | select TOP N * FROM table1 |
postgresql | select * FROM TABLE LIMIT n |