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
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 |
DIFFERENCE BETWEEN SQL SERVER 2005 and 2008
What is set nocount on and what is set nocount off?
What is the use of MOVE keyword in restore command
What does it mean if @@cursor_row returns a negative number?
What is cursor in ms sql server?
What is resource db in sql server?
you have couple of stored procedures that depend on a table you dropped the table and recreated it what do you have to do to reestablish those stored procedure dependencies?
How to use subqueries in the from clause in ms sql server?
What is the basic functions for master, msdb, tempdb databases?
What type of locking occurs during the snapshot generation? : sql server replication
what is the system function to get current user's user id? : Sql server database administration
How to replace null values in expressions using isnull()?
Oracle (3253)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)