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.
我有一个包含1000条数据记录的表。如果我想从表中获取501到700行的数据,而不使用我必须做的任何条件。请建议一个解决方案。
1 个解决方案
#1
2
I guess you can use LIMIT
like this :
我想你可以像这样使用LIMIT:
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 :
此外,您不应该依赖数据默认使用主键进行排序,因此添加ORDER BY语句:
SELECT * FROM my_table
ORDER BY primary_key
LIMIT 500,200; -- get data of rows from 501 to 700
#1
2
I guess you can use LIMIT
like this :
我想你可以像这样使用LIMIT:
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 :
此外,您不应该依赖数据默认使用主键进行排序,因此添加ORDER BY语句:
SELECT * FROM my_table
ORDER BY primary_key
LIMIT 500,200; -- get data of rows from 501 to 700