1. How to fetch all the duplicate records from the table.
2. How to fetch the second highest salary from the table.
Answer Posted / rajkumar v
ANS 1:
select p.ColumnName from tablname p group by p.ColumnName
ans2:
Select min(salary)FROM emp WHERE (salary IN (SELECT
TOP 2 salary FROM emp ORDER BY salary DESC))
Or
Select top 1 salary from (select top 2 salary from emp
order by salary desc) emp order by salary
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What are the different types of sub-queries?
How do I get Report Builder to generate a parameter that can be set by users viewing the report?
What is a deadlock and what is a live lock?
Explain the database you used in your final year project?
How to delete duplicate records based on single column from a table?
What stored by the tempdb ? : sql server database administration
How can I track the changes or identify the latest insert-update-delete from a table?
Explain what are the restrictions that views have to follow? : SQL Server Architecture
What is a natural primary key?
Explain about Normalization?
Why I have to use stored procedures?
What is the native system stored procedure to execute a command against all databases?
What is subquery explain with example?
what is the primary use of the model database? : Sql server administration
What are the different type of replication in sql server?