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 advantages of using stored procedures? : Sql dba
what is offset-fetch filter in tsql? : Transact sql
How can you create an empty table from an existing table?
Can we join tables without foreign key?
what is normalization? : Sql dba
what is a trigger in mysql? Define different types of trigger. : Sql dba
Is clustered index a primary key?
What is user in sql?
how to drop an existing index in mysql? : Sql dba
Can you have more than one trigger on a table?
What is use of term?
What are sql queries used for?
Is a table valued function object?
what is the use of anchoring object? what r the difference between anchoring object & enclosing object? can any one tell me all the details?
What is duration in sql profiler trace?