SQL——MySQL、Oracle、SQL server数据库查询表中前N条记录

在MySQL、Oracle、SQL server数据库中,查询表中前N条记录的关键字不同。

MySQL使用limit

Oracle使用rownum

SqlServer使用top

 

例如:查询出city表中前5行的记录数据

--MySQL
select * from city limit 5
--SqlServer
select top 5 * from city
--Oracle
select * from city rownum <= 5
posted @ 2020-11-11 15:16  !O0O!  阅读(197)  评论(0编辑  收藏  举报