how to find the second highest salary from emp table?
Answer Posted / hridayeshwar rao
select max(age) from yd where age<(select max(age) from HK) ; /// True two table Highest
SELECT * FROM HK E1 WHERE 1 =(SELECT COUNT(DISTINCT age) FROM HK E2 WHERE E1.age < E2.age); ///Second Hightest age RT single table
select age from hk e1 where (3-1) = (select count(distinct (e2.age)) from yd e2 where e2.age>e1.age);//// same True Second Hight age RT two table
select max(age) from YD where age not in (select max(age) from YD); //second hight age in single table
Suppose that salery=age
Thanks !!!
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What are the different types of joins in sql?
What are character functions in sql?
How do I save a sql query?
Is pl sql and postgresql same?
What are the advantages of sql? Explain
Is sql scripting language?
explain the difference between delete , truncate and drop commands? : Sql dba
How to display the records between two range in Oracle SQL Plus?
What is clustered index in sql?
What action do you have to perform before retrieving data from the next result set of a stored procedure ?
What are analytic functions in sql?
Can we use pl sql in mysql?
What is embedded sql with example?
what is the maximum length of a table name, database name, and fieldname in mysql? : Sql dba
What is int identity in sql?