1. We have moved to a new forum! There may be a few things not working properly so please let us know if you find a bug. Remember to use the bbCode [ sql ] tag for SQL statements.

how can i select the third row from table?

Discussion in 'SQL - Questions and Answers' started by nagu, Aug 5, 2006.

  1. nagu Guest

    Dialect: SQL 92
  2. Dimitar Guest

    Dialect: SQL 92
    SQL:

    select max(a) from t where a < (select max(a) from t where a < (select max(a) from t));

    What will the above return if the table is less than 3 in cardinality?
  3. charlesryoung New Member

    Dialect: Oracle
    In most databases, the order of rows in the table are not required to be consistent from one time to another unless you use the ORDER BY statement. Even though it appears that you always see the same order when you SELECT * FROM tbl, you cannot rely on that as new versions of the database come out.

    So the answer to that question depends on what you order by. If you have a customer table ordered by last name, what does the "third row" tell you? Please explain a scenario where getting the third row would be required.
  4. deepak garg New Member

    You can use this and can select whichever row you want to select:

    select * from (select rownum r,col_1,col_2,col_3,col_4 from table_name) t
    where t.r='&z'

Share This Page