Problem solve Get help with specific problems with your technologies, process and projects.

SQL to select rows 1000 through 3000 in a table

An Oracle user asks if they can use SQL to select rows 1000 through 3000 in a table.

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.

Dig Deeper on Oracle development languages