mysql如何指定查询一张表的最后5行记录和最前5行记录
select * from student limit 5;
select * from student limit 0,5;
select * from student order by id asc limit 5;
前五条记录的查询语句。
查询后5条,注意结果为倒序排序,要使用desc
select * from student order by id desc limit 5
select * from student limit m,n;
返回m+1到m+n行记录,m代表开始的下标,n代表查找的结果数,将返回n行结果
select * from student limit 2,8; 返回3到10行记录