Given an employee table, how would you find out the second
highest salary?
Answer Posted / karna
select top 1 a.salary,* from emp a
where a.salary not in(select top (n-1) b.salary from emp b)
here n is the Nth values:if you want secong highest: keep n
as 2 so the query will become
select top 1 a.salary,* from emp a
where a.salary not in(select top 1 b.salary from emp b)
Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
I have a few records all are same structures data, I want to store data in multiple targets how
What is a database development?
Explain about relational database management systems?
How to use online Backups?
When installing the datastage7.5x2 edtion iam getting aproblem i.e the cpu count is 2 but the cpu count in installation is one . how can i install in my p.c (system is dual core).
What is DB Development software?
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?
Explain about the hierarchical model of the database?
Where is dbms used?
State the acid rules?
Explain about query and reporting.
What is the physical representation for a many-to-many relationship?
What are data modelling techniques?
Which data type cannot be used as a parameter in a udf?
How would you design a database for an online site, which would average a million hits a day?