how to retrieve only duplicate values in a table

Answer Posted / sixface

ID NAME
1 ravi
2 umang
1 ravi
3 nishant

SELECT id,name
FROM emp
WHERE id in
(
SELECT id
FROM emp
GROUP BY id
HAVING COUNT(*) > 1
);
It gives all duplicate rows........
Lets try.....

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between distinct and unique in sql?

464


What are database links used for?

585


Is sql port 1433 encrypted?

563


Can there be 2 primary keys in a table?

548


What are different types of queries in sql?

511






What is scalar function?

558


How do I view tables in mysql?

532


Can we use view in stored procedure?

495


Write a sql query to find the names of employees that begin with ‘a’?

568


What is sql keyword?

547


What is information schema in sql?

571


how to implement one-to-one, one-to-many and many-to-many relationships while designing tables? : Sql dba

535


What steps server process has to take to execute an update statement?

500


Can we declare a column having number data type and its scale is larger than pricesionex: column_name number(10,100),column_name numbaer(10,-84)

528


what is a relationship and what are they? : Sql dba

544