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 is union, minus and interact commands?
How do I make sql search faster?
What is a loop in sql?
What is faster join or subquery?
What is data profiling in sql?
Is sql pronounced sequel or sql?
What is the function that is used to transfer a pl/sql table log to a database table?
Explain the types of joins in sql?
What are three advantages to using sql?
How can you fetch common records from two tables?
what is the difference between primary key and unique key? : Sql dba
what are the 'mysql' command line options? : Sql dba
Why stored procedures are faster than query?
Define concurrency control. : Transact sql
what is a stored procedure? : Sql dba