How to retrieve Duplicate Rows only in a Table?
Suppose if a Table Name is "Education". It consists of
multiple columns. Then if we insert rows into this table
with duplicate records then how can we retrieve only
duplicate records from that table?

Answer Posted / jay k patel

SQL> select * from emp;

ENO ENAME DOJ DESGN ADDRESS BSAL
---------- ------- --------- ------- ------- ----------
1 jay 04-JAN-80 md vapi 50000
2 vijay 04-FEB-75 manager vapi 7000
1 ajay 12-JAN-77 dba vapi 9000
3 rajay 05-MAR-70 cleark vapi 5000
4 sujay 28-JAN-73 dba vapi 6000
5 jayesh 07-APR-74 cleark vapi 8000
7 jaymin 04-JAN-62 analyst vapi 4000
6 jaynis 10-MAY-69 dba vapi 9000
1 jayur 04-JAN-74 manager vapi 4000
12 jaynil 14-DEC-71 cleark vapi 2000

10 rows selected.

SQL> SELECT desgn , count(*)
2 FROM emp
3 GROUP BY Desgn
4 Having count(*) > 1 ;

DESGN COUNT(*)
------- ----------
cleark 3
dba 3
manager 2

SQL>

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a sql select query that only returns each name only once from a table?

577


how to add a new column to an existing table in mysql? : Sql dba

591


What are the two types of exceptions in pl/sql?

550


What is data abstraction in sql?

515


How do I tune a sql query?

516






What is the difference between database trigger and stored procedure?

559


How do I trace sql profiler?

498


how to shut down the server with 'mysqladmin'? : Sql dba

553


Is nosql faster than sql?

546


Explain exception handling in pl/sql?

535


What is rownum in sql?

561


Does truncate free space?

524


What are the 3 types of behavioral triggers?

679


What is the sql query to display the current date?

555


What does 0 mean in sql?

532