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
Why main is user defined function?
What is normalization process?
How do I find the size of a sql server database?
What is difference between join and natural join?
What is implicit cursors?
How to list all login names on the ms sql server?
Explain the Ways to improve the performance of a sql azure database?
Write a query for primary key constraint with identity key word?
Does order by actually change the order of the data in the tables or does it just change the output?
How to send a ssrs report from ssis?
What is difference statement and preparedstatement?
Why you need indexing? Where that is stored and what you mean by schema object? For what purpose we are using view?
If user is owning any SQL Objects, can we drop that user
What is 3nf normalization?
How can you find out which stored procedures are recompiling?