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
Find columns used in stored procedure?
‘Order by’ is not allowed in a view how can you sort information from a view?
What Is Rdbms?
How do you create a data source?
How do I setup a sql server database?
What is cte (common table expression)?
Can you explain what are various ways to enhance the ssrs report?
Is t sql the same as sql server?
what are defaults? Is there a column to which a default can't be bound? : Sql server database administration
What is the exact numeric data type in sql?
there is a trigger defined for insert operations on a table, in an oltp system. The trigger is written to instantiate a com object and pass the newly inserted rows to it for some custom processing. What do you think of this implementation? Can this be implemented better? : Sql server database administration
Does windows server 2016 come with sql server?
How can you fetch alternate records from a table?
Retrieve the unique rows from table without using UNIQUE and DISTINCT keywords.
What are the differences in Clustering in SQL Server 2005 and 2008 or 2008 R2?