【问题标题】:find the 5th row in a SQL query在 SQL 查询中查找第 5 行
【发布时间】:2025-12-01 13:55:02
【问题描述】:

我正在使用 MySQL/MySQL Workbench,如果我想通过 studentName 选择第 5 个返回的行顺序,解决方案是什么?谢谢。

select * from Students order by studentName;

提前致谢, 林

【问题讨论】:

标签: mysql sql


【解决方案1】:

您可以在下面使用LIMIT

SELECT * 
FROM Table1 
ORDER BY Id 
LIMIT 4,1 -- here you provide which row you want to retrieve
          -- 4 indicates from which row start selecting (offset)
          -- 1 - how many rows you want to retrieve
          -- you can change It as you like

【讨论】:

  • 应该限制为 4,1。