Given an employee table, how would you find out the second
highest salary?
Answer Posted / trived
select * from emp
where n-1 = (select count(*) from emp e
where emp.salary<e.salary)
in place of n-1 you can keep zero for first hight salary
and 1 for second hightest salary.....etc
| Is This Answer Correct ? | 9 Yes | 3 No |
Post New Answer View All Answers
Explain the rollup operator?
How to replace not in with not exist?
How you can make a parameterized view?
What is the maximum length of an extended property?
Where is dbms used?
The count() function always returns a int value type what should you do if you need to count rows from a query which you know will return a value that is too large for an int value type?
How can I detect whether a given connection is blocked?
How to use timestamp datatypes
Explain what a database is?
You have a table with three columns: amount1, amount2, and amount3 in a single row only one of these three columns will have a value and the other two will be null. Write a sql query to retrieve the values from these columns?
What are the 18 schemas?
What is a database development?
What are the three basic rules which are to be followed for the relational model of the database?
Explain the cube operator?
What is database design and development?