how to find the second highest salary from emp table?
Answer Posted / sagar
if the salary is simple non-duplicate salary, you can use
the below queries:
select max(sal) from emp where sal != (select max(sal) from emp)
you can also try
select sal from (select * from emp order by sal desc) where
rownum = 2
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is dense_rank?
How to pronounce postgresql?
What is an exception in PL/SQL? What are the two types of exceptions?
What is sql integrity?
What is the purpose of my sql?
what is transaction? : Sql dba
Can a composite key be null?
How can you view the errors encountered in a trigger?
what is the difference between char and varchar data types? : Sql dba
What is sql exception?
what are the differences between procedure-oriented languages and object-oriented languages? : Sql dba
Compare sql & pl/sql
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
What is compound trigger?
What is write ahead logging in sql server?