how to retrive only second row from table?

Answers were Sorted based on User's Feedback



how to retrive only second row from table?..

Answer / kishan kumar

select empno,ename,sal,comm,job,mgr,deptno from emp
group by empno,ename,sal,comm,mgr,deptno,rownum 
having rownum in (2);

Is This Answer Correct ?    2 Yes 0 No

how to retrive only second row from table?..

Answer / kishore.p

select top 1 * from tblemp b where b.empsal not in(select
top n-1 empsal from tblemp e)

note:- here the n will be the number of only row you would
like to display.

here in the above case n=2 i.e., n-1=1

so this will be the querry:

select top 1 * from tblemp b where b.empsal not in(select
top 1 empsal from tblemp e)

Is This Answer Correct ?    1 Yes 0 No

how to retrive only second row from table?..

Answer / m

IN Mysql we can do like this,
in that number starts from 0 so first parameter show
after LIMIT is row no. means here second row
and next 1 for limit that how many records do u want
to show. it means 1 record.


SELECT *
FROM `student_info`
LIMIT 1 , 1;

Is This Answer Correct ?    1 Yes 0 No

how to retrive only second row from table?..

Answer / shince jose

select * from (

select ROW_NUMBER() OVER (ORDER BY alias) as rowid ,alias

from tbl) a where rowid=2.

Is This Answer Correct ?    1 Yes 0 No

how to retrive only second row from table?..

Answer / rajeev thakur

(select * from emp where rownum<3) minus (select * from emp
where rownum<2);

Is This Answer Correct ?    1 Yes 0 No

how to retrive only second row from table?..

Answer / amedela chandra sekhar

SQL> select * from (select rownum as rno,emp.* from emp)
2 where rno=&n;
Enter value for n: 2
old 2: where rno=&n
new 2: where rno=2

RNO EMPNO ENAME JOB MGR
HIREDATE SAL
---------- ---------- ---------- --------- ----------
--------- ----------
COMM DEPTNO
---------- ----------
2 7499 ALLEN SALESMAN 7698
20-FEB-81 1600
300 30

Is This Answer Correct ?    1 Yes 0 No

how to retrive only second row from table?..

Answer / vamsi nukala

select * from(select rownum as rno,emp.* from emp)where rno=2;

Is This Answer Correct ?    1 Yes 0 No

how to retrive only second row from table?..

Answer / sushma s

select * from emp where rownum<=2
minus
select * from emp where rownum<2

Is This Answer Correct ?    1 Yes 0 No

how to retrive only second row from table?..

Answer / amit kumar (patna)

select * from
( select rownum rn, job_ticket_mst.* from job_ticket_mst where rownum<=2)
where rn=2

Is This Answer Correct ?    1 Yes 0 No

how to retrive only second row from table?..

Answer / priya

select * from emp where empno < (select max(empno) from
emp) and rownum<2 order by empno desc

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More SQL PLSQL Interview Questions

How we get all_group_function's(Sum,avg,count,max and min_value of a column(Sal) Using pl/sql anonymous block, with out using group function's. You shouldn't use more than one select statement in entire the program. Like cursor c is select * from <table_name>; except this you can't use another select statement. You can use no of variables as per requirement.

1 Answers  


What is the usage of distinct keyword?

0 Answers  


what is a database transaction? : Sql dba

0 Answers  


how to find the First and Last Observation from the table: Ex: OBS Name Sal Ans like: OBS Name Sal 105 E 5000--> 105 E 5000 102 B 2000 104 D 4000 103 C 3000 101 A 1000--> 104 D 4000

4 Answers  


how would you enter characters as hex numbers? : Sql dba

0 Answers  






What is data type in sql?

0 Answers  


What is normalisation and its types?

0 Answers  


How do you drop a trigger?

0 Answers  


What is int identity in sql?

0 Answers  


What is an exception in PL/SQL? What are the two types of exceptions?

0 Answers  


what is the difference between to_char and to_date functions?

10 Answers   Infosys,


What is the difference between joins?

0 Answers  


Categories