Ideally I need a query that is equivalent to
select * from customer where row_number() = 3
but that's illegal.
I can't use an auto incremented field.
row_number() is the row that needs to be selected.
How do I go about this?
EDIT: Well, I use iSql*plus to practice, and using limit and auto_increment is illegal for some reason. I ended up creating a sequence and a trigger and just upped the id by 1 every time there was an entry.
stackoverflow@objekt.click
You can use LIMIT 2,1
instead of WHERE row_number() = 3
.
As the documentation explains, the first argument specifies the offset of the first row to return, and the second specifies the maximum number of rows to return.
Keep in mind that it's an 0-based index. So, if you want the line number n, the first argument should be n-1. The second argument will always be 1, because you just want one row. For example, if you want the line number 56 of a table customer
:
SELECT * FROM customer LIMIT 55,1