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
Do prepared statements prevent sql injection?
what is a join? : Sql dba
what are the maximum number of rows that can be constructed by inserting rows directly in value list? : Transact sql
Why is pl sql needed?
Why commit is not used in triggers?
Mention what does plvtab enables you to do when you showthe contents of pl/sql tables?
what is the difference between truncate and delete statement? : Transact sql
What does plv msg allows you to do?
What are all the different normalizations?
How to rename a table?
How many types of triggers are there in pl sql?
How do I count duplicates in sql?
what is the difference between mysql_fetch_object and mysql_fetch_array? : Sql dba
How to add new employee details in an employee_details table with the following details
How to change a value of the field ‘salary’ as 7500 for an employee_name ‘john’ in a table employee_details?