Search the MySQL manual:
MySQL Manual

Buy this Reference Manual in softcover from Barnes & Noble!

/ / Up / Table of Contents

5.2.8 Как MySQL оптимизирует LIMIT

В некоторых случаях, когда используется LIMIT # и не используется HAVING, MySQL будет выполнять запрос несколько иначе:

User Comments

Posted by on Wednesday December 18 2002, @5:27pm [Delete] [Edit]

Here is an example of how to use Limit:

The first example will limit the result to the first 10 items.
SELECT name FROM customers LIMIT 10

This example will limit the result to 10 rows, starting with row 5.
SELECT name FROM customers LIMIT 5 , 10

If you only use one parameter, it will be the number of rows to return, if you use two
parameters, it will be where to start, and then the number to return.

Bill

Posted by [name withheld] on Wednesday December 18 2002, @5:27pm [Delete] [Edit]

I'm not going to hazard a guess at what exactly
is going on internally, but this

LIMIT 10, -1

will return the 11th record through end of table
(indexing starts at 0).

Add your own comment.

Top / / / Up / Table of Contents