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 pl sql script?
Why do we need pl sql?
What is an exception in pl/sql?
Why do we create stored procedures & functions in pl/sql and how are they different?
Is sql procedural language?
What is a trigger in sql?
What is pl sql block in dbms?
What is not equal in sql?
What does select top 1 do in sql?
Is like operator in sql case sensitive?
What are system versioned tables?
When sql appeared?
Cite the differences between execution of triggers and stored procedures?
How does postgresql compare to "nosql"?
List different type of expressions with the example.