1. How to fetch all the duplicate records from the table.
2. How to fetch the second highest salary from the table.
Answer Posted / rajkumar v
ANS 1:
select p.ColumnName from tablname p group by p.ColumnName
ans2:
Select min(salary)FROM emp WHERE (salary IN (SELECT
TOP 2 salary FROM emp ORDER BY salary DESC))
Or
Select top 1 salary from (select top 2 salary from emp
order by salary desc) emp order by salary
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What are the differences between INNER JOIN, LEFT JOIN and RIGHT JOIN in SQL Server?
what are different types of raid configurations? : Sql server database administration
What do you understand by a view?
ow to bring suspect mode datbase online from scratch
How can we remove orphan records from a table?
Explain triggers?
How to access the deleted record of an event?
What is dbcc?
What is primary key and example?
What is xml datatype?
What are recommended options to be used while using db mirroring? : sql server database administration
How is table type constraint applied to a table?
can we have a nested transaction? : Sql server database administration
How to get a list of table columns using the "sp_columns" stored procedure in ms sql server?
What are the differences between char and varchar in ms sql server?