how to retrive only second row from table?
Answers were Sorted based on User's Feedback
Answer / saswati
select a.*
from(select e.*,rownum sl_no
from emp e) a
where a.sl_no = 2
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / anusha
select * from ars_mst_user where rownum<5
minus
select * from ars_mst_user where rownum<=3;
this query for retrive fourth row
same we can retrive any row
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / sudip chatterjee
If the table is salary.then
SELECT * FROM salary ORDER BY income DESC LIMIT 1, 1;
here income is one attribute of salary table......
just use it.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / thanjairajan@gmail.com
select * from emp a where 2=(select count(distinct(b.rowid)) from emp b where a.rowid>=b.rowid;
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / yogendra
select top 1 * from (select top 3 * from
cmdview_expertmaster order by expid) q order by expid desc
| Is This Answer Correct ? | 1 Yes | 3 No |
Answer / nilesh
hi all,
This will also work fine, try it
select top 1 * from (select top 2 * from table_name)as set
order by set.col_name desc
here table_name is the name of the table from which
you want to retrive the record.
And col_name is the column name by which you are sorting
the records
If it found wrong plz correct it....
and show it on this site
| Is This Answer Correct ? | 2 Yes | 5 No |
Answer / naresh
select * from emp e where 2=(select count(*) from emp where
sal>=e.sal);
| Is This Answer Correct ? | 0 Yes | 3 No |
Answer / ayan
SELECT * FROM employees a
WHERE 2 = (SELECT COUNT(rowid)
FROM employees b
WHERE a.rowid >= b.rowid);
this will select the 2nd row.. if we write instead of 2 it
will select 8th row.... login to hr/hr schema and run the
code. it will work fine..
| Is This Answer Correct ? | 3 Yes | 7 No |
Answer / ehtesham malik
select * from emp
where rowid = (select min(rowid) from emp
where rowid not in (select min(rowid)
from emp)
)
| Is This Answer Correct ? | 4 Yes | 9 No |
Answer / sagar
SELECT * FROM tab a
WHERE :n = (SELECT COUNT(rowid)
FROM tab b
WHERE a.rowid >= b.rowid);
| Is This Answer Correct ? | 14 Yes | 33 No |
What is an inner join sql?
How run sql*plus commands that are stored in a local file?
why use cursors?
What is index example?
How collections are improve the performance?
HOW TO TUNE ORACLE SQL QUERIES GIVE ME STEP BY SREP
what is heap table? : Sql dba
Why triggers are used?
What is before trigger?
Explain UNION,MINUS,UNION ALL, INTERSECT?
What is tuple in sql?
have table with two columns with datatypes as number and varchar and the values in A column like 1,2,3 AND B column values like a,b,c. now need to display data in a single column as 1,a,2,b,3,c.
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)