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

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

Answers were Sorted based on User's Feedback



1. How to fetch all the duplicate records from the table. 2. How to fetch the second highest sala..

Answer / jyoti

even i m suffering from this Q. plz let me knw?

Is This Answer Correct ?    1 Yes 5 No

1. How to fetch all the duplicate records from the table. 2. How to fetch the second highest sala..

Answer / devraj

(1) Query to fetch all duplicate records:

Select * From emp02 Where Rowid Not In (Select Min(Rowid)
From emp02 Group By No, ename, Work)

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

Select * From (Select a.*, dense_rank () Over (Order By sal
Desc) Vb From emp02 a) Where Vb = 2;

Is This Answer Correct ?    7 Yes 12 No

Post New Answer

More SQL Server Interview Questions

How to use user defined functions in expressions?

0 Answers  


hi, how to match retrieve the unmatched records from 2 tables in which we dont have any primary key. example : table1 has 1,2,3,4,5 and table2 has 1,2,3,4,5,6,7,8,9,10 and i want the numbers from 6 to 10 to be displayed and should not come as null. i need the numbers. please reply as soon as possible.

4 Answers  


What is table join?

0 Answers  


mention different types of relationships in the dbms?

0 Answers  


SQL Server Performance Tuning for Stored Procedures & reducing debugging time?

1 Answers   CarrizalSoft Technologies,






How do I find the sql server version?

0 Answers  


Can multiple columns be used in sql group by clause in ms sql server?

0 Answers  


What is mapping schema?

0 Answers  


What area unit the various kinds of info compression introduced in sql server 2008?

0 Answers  


Is it possible to replicate data from sql server to oracle? : sql server replication

0 Answers  


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

0 Answers  


what is statistics

1 Answers  


Categories