Relational database tables do not have row numbers. Relational database tables are literally modeled after the mathematical concept of a set: a collection of items with no order. If the items are unordered, then none of them can be said to have a ordinal number.
That said, you can instruct a relational database to place an arbitrary order on the data returned in a result set. You do this with the "ORDER BY" clause of a "SELECT" query.
So if you want the specific second item of an ordered result set, something like:
SELECT * from tablename ORDER BY firstname, lastname LIMIT 2,1
The "LIMIT" clause in this case tells MySQL, starting at row 2, to return 1 record from the result set.
As sleipnir says, the relational model mandates that all data and relationships must be described by, be accessible via, the values of data items. Ordering or links are forbidden.
As we all know it works, and it works so well there are hardly any databases that don't now conform to this view of life.
As a result your query must be easily re-expressed in terms of some value rather than row number.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.