I am having a hard time understanding the limit and offset parts of MYSQL. Could someone use this example "Get the 101st to 200th actor from the actors table. (No need to use any ordering)." and explain to me how this would work and the math behind it? Thanks!

有帮助吗?

解决方案

`SELECT * FROM table limit 100, 100` -- get 100 records from row 101 (101 - 200)

This will give you 50 records after 101:

`SELECT * FROM table limit 100, 50` -- get 50 records from row 101 (101 - 150)

For more details, you can see the syntax and usage for limit here.

其他提示

 select actor
 from actorTable limit 100, 200

it will get all the actor starting from 101 up to 200 it will always add 1 to the min limit up to the max limit which is 200

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top