Write a query to get 2nd maximum salary in an employee table ?
Answer Posted / surajit pathak
select * from emp e1
where 2>(select count(1) from emp e2
where e2.sal>e1.sal)
order by sal desc
| Is This Answer Correct ? | 1 Yes | 4 No |
Post New Answer View All Answers
How much does sqlite cost?
What are the string functions in sql?
What is execution plan in sql?
Where do we use pl sql?
What is the difference between nested table and varray?
What is an invalid partition table?
What is sap sql?
What is having clause in sql?
How many disk partitions should I have?
How do you break a loop in pl sql?
What makes a good primary key?
What schema means?
How run sql*plus commands that are stored in a local file?
What is the difference between delete and truncate commands?
Table 1: col1 Timestamp ---------------- 01-mar-2012 11:12:46 Table 2: col2 Timestamp -------------------- 01-mar-2012 11:12:10 01-mar-2012 11:11:23 Write a query to display a row with table2 col2 value less than tabl1 col1 value. Maximum timestamp value previous to table1 col1 value. Display a result as: Col1 col2 ----- ----- 01-mar-2012 11:12:46 01-mar-2012 11:12:10