1. How to fetch all the duplicate records from the table.

2. How to fetch the second highest salary from the table.

Answer Posted / amit kumar

(1) Query to fetch 2'nd highest salary:

Select max(sal) from emptable where sal not in (Select
max(sal) from emptable)

(2) How to fetch all the duplicate records from the table.

SELECT COUNT(*), <COLUMN_NAME> FROM EDUCATION GROUP BY
<COLUMN_NAME>

Is This Answer Correct ?    10 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can primary key be a foreign key?

563


What is dbcc updateusage?

536


Explain isolation levels that sql server supports?

567


What is check constraint in sql server?

523


What is a covering index?

533






What are unicode character string data types in ms sql server?

602


Explain partitioned view?

588


What is merge statement?

626


What does REVERT do in SQL Server 2005?

560


What is pessimistic concurrency?

540


Explain nested stored procedure. Syntax and an example for create nested stored procedure?

530


What is dbcc?

733


Can a stored procedure call itself or a recursive stored procedure? How many levels of sp nesting is possible?

581


What is store procedure? How do they work?

580


what are the new features introduced in sql server 2000? : Sql server database administration

544