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
What is DB Development software?
What is the maximum length of an extended property?
Explain the cube operator?
What are data modelling techniques?
Which four data types cannot be used as a return type from a user-defined function?
What are the types of database model?
What are the 18 schemas?
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?
Explain about xml databases?
Explain the rollup operator?
How to use online Backups?
Pgm A calls Pgm B and pgm B uses cursor, when pgm B is called second time, the program is abending saying the cursor is opened? Why?
What is normalization? Explain different levels of normalization?
What is an application role and explain a scenario when you would use one?
How long can an error message be in raiseerror function?