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 Column_Name from Table_Name group by Column_Name
having count(Column_Name )>1

Ans:2
salary - column name

SELECT TOP 1 salary FROM (SELECT DISTINCT TOP 2 salary FROM
Table_Name ORDER BY salary DESC) A ORDER BY salary

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is compound operators?

550


What is change data capture (cdc) in sql server 2008?

564


What is it’s similarity with sql server?

143


What is a View ? Can we insert, Update and delete a view?

629


Is it possible to create trigger on views?

547






How to transfer an existing table from one schema to another schema in ms sql server?

510


Explain about builtinadministrator?

593


How you can get the list of largest tables in a database?

527


What is the difference between a clustered index and a non-clustered index?

531


What is Replication?

631


Can we add an identity column to decimal datatype?

582


What’s the use of custom fields in report?

569


how many type of indexing in database?

579


Tell me extended events in sql server 2008?

557


How is foreign key related to primary key?

574