分享

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

 戈安御凝 2021-01-02

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

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多