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

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

Answer Posted / ashwini

2. Second highest salary from the table

select top 1 salary from emp where salary NOT IN
(SELECT MAX(salary) FROM emp)order by salary desc

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

on line cluster can we make if yes tell me the procedure

1517


What is the xml datatype?

625


What is msdb database? : SQL Server Architecture

538


What stored by the model?

550


How to sort query output in descending order in ms sql server?

548






Explain the various types of concurrency problem?

698


What is the data tier application?

145


How to list all triggers in the database with sys.triggers in ms sql server?

536


What will be query used to get the list of triggers in a database?

549


How do you rename a table in sql server?

490


What are the advantages of the mirroring?

569


What command do we use to rename a db, a table and a column?

503


Define the one-to-one relationship while designing tables.

509


Explain the difference between function and stored procedure?

513


Why are you getting errors when creating a new odbc dsn?

587