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

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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the stuff?

618


What are different type of Collation Sensitivity?

657


How would you go about developing a ssrs report?

120


What is standby servers? Explain types of standby servers.

594


What is a dbms wizard?

698






Explain activity monitors

705


Can we write trigger for view?

634


what exactly sql injuction.how to overcome.....

2140


How to find the version of sql server? : sql server database administration

710


How do I save a stored procedure in sql server?

581


explain different levels of normalization? : Sql server database administration

602


What is a hint?

656


What are system databases into sql server (2005/2008) : sql server database administration

659


What is your recommendation for a query running very slow? : sql server database administration

674


What stored by the msdb? : sql server database administration

637