how to find the second highest salary from emp table?
Answer Posted / prudhvi
select sal from emp a where 1=(select count(*) from emp b where a.sal>b.sal);
Try this guys,if u want highest sal use 0 in where condition, for second highest 1,third 2........
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is sql injection vulnerability?
What is the purpose of primary key?
What is dml and ddl?
what is 'mysqldump'? : Sql dba
how mysql optimizes distinct? : Sql dba
What is pivot table in sql?
What is the left table in sql?
Sql technical questions
what does it mean to have quoted_identifier on? : Sql dba
What are types of exception?
What is sql prepared statement?
how many sql ddl commands are supported by 'mysql'? : Sql dba
What is sql partition function?
What is the syntax and use of the coalesce function?
What is the sql*loader? : aql loader