从数据库查询前五条记录的sql

oracle:

select * from table1 where rownum <=5

mysql:

select * from table1 where 1=1 limit 5

sqlserver:

读取前5条:select top(5)* from table1 where 1=1

读取后5条:select top(5)* from table1 order by id desc

access:

select top(10)* from table1 where 1=1

db2:

select column from table1 where 1=1 fetch first 10 rows only

(0)

相关推荐