mysql怎么指定查询一张表的查询结果,如最后5行记录和最前5行记录

2025-04-12 22:44:03
推荐回答(1个)
回答1:

select * from 表名 order by 字段名 desc limit 0,5; // 倒序查询
select * from 表名 order by 字段名 ASC limit 0,5; // 升序查询
select * from 表名 //查询表下全部信息

select * from 表名 order by 字段名 limit 0,5 // 默认是升序查询