Ask The Oracle Expert: Questions & Answers

SQL to select rows 1000 through 3000 in a table

SQL to select rows 1000 through 3000 in a table

By  Rudy Limeback, SQL Consultant, r937.com

SearchOracle.com

I want to select, say, the 1000th row through 3000th row in a table. How can I do this? I don't have a sequence row in the table.

You probably meant to say that you don't have a sequence column in the table.

I am sorry to tell you that the answer to your question is "You can't." This is because rows in a database table have no sequence. The only time that you can see a sequence is when you use an ORDER BY clause in your SELECT statement. You need to specify at least one column for the ORDER BY. Even then, picking rows 1000 through 3000 is tricky, as the SQL depends entirely on which database system you're using.

Without an ORDER BY clause, the whole concept of "rows 1000 through 3000" has no meaning.