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

you accidentally delete the msdb database what effect does this have on your existing sql databases, and how do you recover? : Sql server administration

0 Answers  


What is the standby server?

0 Answers  


What is sorting and what is the difference between sorting and clustered indexes?

1 Answers  


How to list all tables having unique constraints in any of the columns in a database.

1 Answers  


What does indexation mean?

0 Answers  






what are the different types of replication you can set up in sql server? : Sql server database administration

0 Answers  


Can binary strings be used in arithmetical operations?

0 Answers  


How real and float literal values are rounded?

0 Answers  


What are the different sql server versions?

0 Answers  


CTE(common table expression)

1 Answers   Thomson Reuters,


What is use of attribute hierarchy ordered ? : sql server analysis services, ssas

0 Answers  


What is importing utility?

0 Answers  


Categories