Interview Question

Lead Consultant Interview

-Gurgaon, Haryana, Haryana

hCentive

Given a table containing Employee names & Age, give a SQL Select query to find out the list of 2nd oldest people.

Answer

Interview Answers

3 Answers

0

Can use a combination of MAX(age) inside an inner query

Anonymous on

0

select max(p.age) from persons p where p.age < (select max(p1.age) from persons p1 where p.age = p1.age)

Nikhil on

1

need an inner join: like select * from table T1 where (select count(*) from table T2 where T2.age

Anonymous on

Add Answers or Comments

To comment on this, Sign In or Sign Up.