I want to use SQL to select a record by its row number.
"SELECT * FROM dvdTable WHERE ROW_NUMBER = 1";
The reason being that a GUI displays a next button and gets a file path stored in the database. File path is used to create an image icon (using code I found here actually )
My method basically looks something like this:
String filePath = methods.getNextFilePath(dvd);
where there have been deleted records and there are gaps between the primary keys, the database is returning nothing as there is no record where the dvd integer is being passed into the method.
There are gaps ? How could there be gaps ?
There are gaps because when the method sets the dvd number to say 3 and the record with a primary key 3 has been deleted, because of auto increment there is no record to return.
The next record to return would maybe be 14, but you have to keep pressing the next button until int dvd reaches 14 you see?
Anyway I figured out a way to do it. I just used a constructor and an ArrayList to return a set of results. That way I will be cycling through using only the primary keys that exist and not one that I have tried to enter myself