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
How do I start sql server 2017?
How you can change a cross join into an inner join?
How to create a trigger for insert only?
You schedule a job to run every minute what will happen if the first job runs more than 1 min? Will the second instance of the job start?
What is a trigger and types of a trigger?
What’s the distinction between dropping a info and taking a info offline?
How to update muliple row in single query?
How to create a login account in ms sql server to access the database engine using "create login" statements?
Explain steps of normalization?
Define Joins?
As a general practice, it is recommended to have dbo be the owner of all database objects however, in your database you find number of tables owned by a user other than dbo, how could you fix this?
what number files will a information contain in SQL Server? How many forms of information files exist in SQL Server? How many of those files can exist for a single database?
Explain having clause?
What is the use of stored procedure?
Is null in sql server?