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 Column_Name from Table_Name group by Column_Name
having count(Column_Name )>1
Ans:2
salary - column name
SELECT TOP 1 salary FROM (SELECT DISTINCT TOP 2 salary FROM
Table_Name ORDER BY salary DESC) A ORDER BY salary
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
what are database files and filegroups? : Sql server database administration
How can you transfer data from a text file to a database table? Or how can you export data from a table to a comma delimited (csv) file? Or how can you import data from ms access to a table in a database? Or how can you export data from a table to an excel file?
Explain the steps to create and execute a user-defined function in the sql server?
What are four major operators that can be used to combine conditions on a where clause?
Explain transaction isolation levels in sql server?
What is difference between equi join and natural join?
How to create stored procedures with parameters in ms sql server?
How do I find the default sql server instance?
Please illustrate physical database architecture? : SQL Server Architecture
What is cte (common table expression)?
What does this statement do @@rowcount?
How to use subqueries with the in operators in ms sql server?
Explain primary key, foreign key and unique key?
Differentiate between SQL and ORACLE joins and write their syntax.
Explain syntax for dropping triggers?