How does 'LIMIT' parameter work in sql?

后端 未结 6 1291
余生分开走
余生分开走 2020-12-14 17:52

I have 4000 rows for example, and I define X limit.

The query stops after it finds X rows? or the query finds all the rows and then takes X rows from the found rows?

6条回答
  •  臣服心动
    2020-12-14 18:24

    SELECT * FROM your_table LIMIT 0, 10

    This will display the first 10 results from the database.

    SELECT * FROM your_table LIMIT 5, 5

    This will show records 6, 7, 8, 9, and 10

    It's like telling MySql; I want you to start counting from 5+1 or the 6th record, but Select only upto 5 records

提交回复
热议问题