Pergunta

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!

Foi útil?

Solução

`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.

Outras dicas

 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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top