-5

I have a table of 1000 records of data. If i want to get data of rows from 501 to 700 from the table without using any condition what I have to do.Please suggest a solution.

techsolutions
  • 20
  • 1
  • 5

1 Answers1

6

I guess you can use LIMIT like this :

SELECT * FROM my_table
    LIMIT 500,200; -- get data of rows from 501 to 700

Moreover, you should not rely data to be sorted with primary key by default, so add an ORDER BY statement :

SELECT * FROM my_table
    ORDER BY primary_key
    LIMIT 500,200; -- get data of rows from 501 to 700
halfer
  • 19,824
  • 17
  • 99
  • 186
Yoric
  • 1,761
  • 2
  • 13
  • 15
  • 2
    Note that without an `order by` the returned data is random – juergen d Oct 15 '14 at 10:18
  • @techsolutions: don't forget to accept this answer, if it worked for you. To accept an answer, click on the 'tick' mark to the left, so it turns green. This is how we mark a question as solved here. – halfer Mar 30 '15 at 12:09