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
What is table constraint?
What is acid mean in sql server?
How you can get the list of largest tables in a database?
What are the differences between char and nchar in ms sql server?
What is the difference between a local and a global temporary table?
How can I check if a view exists in a sql server database?
What is encryption key?
What does indexation mean?
What is the default fill factor value?
How to create a view and a stored procedure in ms sql server using "create view/procedure" statements?
Tell me when is the update_statistics command used?
How to sort query output in descending order in ms sql server?
how would you write a sql query to compute a frequency table of a certain attribute involving two joins? What changes would you need to make if you want to order by or group by some attribute? What would you do to account for nulls?
Why union all is faster than union?
What is buffer cash and log cache in sql server?