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

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

Answer Posted / sneha s

fetch duplicate records from table:
select column_name from table_name group by column_name having count(column_name)>1;

get the second highest salary:
select distinct salary from emp order by salary desc limit 1,1;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between an index and a unique index?

545


How to add more data to the testing table in ms sql server?

556


What is a db view?

516


What do you mean by cardinality?

491


what is a traditional network library for sql servers? : Sql server database administration

464






What are the differences between clustered and non-clustered index?

539


Can two tables share a primary key?

516


explain what is raid and what are different types of raid configurations? : Sql server database administration

550


How many triggers are possible per table?

626


Can you create a logon trigger in sql server 2005 express edition?

574


How to find out what is the default collation in a database?

626


Should you normalize audio?

529


Tell me what is log shipping?

569


How can I check that whether automatic statistic update is enabled or not?

557


Are resultset updatable?

522