How to find out duplicate records in a table(Query)

Answers were Sorted based on User's Feedback



How to find out duplicate records in a table(Query)..

Answer / vishal

try this query

select name,count(*) from X1 (X1 being the table name)
group by name
having count(*)>1

Is This Answer Correct ?    12 Yes 2 No

How to find out duplicate records in a table(Query)..

Answer / madhav

select name,count(name) from mastertable group by name
having count(name)>1

instead of NAME use your own fields


Best of luck

Is This Answer Correct ?    7 Yes 1 No

How to find out duplicate records in a table(Query)..

Answer / santosh

we have to use the group by with having command to get the duplicate values. this query shall show the result of only the users have duplicate values in the employee table.

Syntex:
Select columnName From Table_name
Group By columnName
Having count (*) > 1

Example:
SELECT UserID FROM employee
GROUP BY userid
HAVING count( * ) > 1

Is This Answer Correct ?    4 Yes 0 No

How to find out duplicate records in a table(Query)..

Answer / deepika galankar

if table " stud " contains data :
studid name
1 xyz
2 pqr
3 per
1 xyz

then query is

select name ,count(name) from stud
group by name
having count(name)>1;

thank u .

Is This Answer Correct ?    3 Yes 2 No

How to find out duplicate records in a table(Query)..

Answer / lakshmanlal

hi gud evening all, this is lakshmanlal.k.
suppose my table EMP having one column like ENAME in that i
am having 5 values like lakshman,lakshman,siva,rajesh,kiran
now i am writing query for duplicate records
select ename from EMP(tablename)
group by ename
having count(ename)>1

Is This Answer Correct ?    0 Yes 1 No

How to find out duplicate records in a table(Query)..

Answer / sekhar

select records from table where count(record)>1

Is This Answer Correct ?    0 Yes 4 No

Post New Answer

More Testing AllOther Interview Questions

How to improve in english

0 Answers   STS,


Could anyone share FAQs for Test Manager position.

1 Answers  


What is service pack..what is the purpose of this..?This question was asked in an testing interview..that's why i posted this in this category..

1 Answers   Infeneon Technologies,


What advantages would using an iSCSI Storage Area Network (SAN) give to your organization over using Direct Attached Storage (DAS) or a Fibre Channel SAN?

0 Answers  


can anybody tell me the architecture for window based application and for the web based application for java as well as dotnet application(web based and for window based).its very very urgent pls

0 Answers  






Mention what the difference between a 'defect' and a 'failure' in software testing is?

0 Answers  


what is differnete between bug report@bugtracking

1 Answers   TCS,


Define the notion of transaction and deadlock ?

1 Answers  


What are the layers of FCOE Protocol?

0 Answers  


words Mortal Combat, Street Fighter, Dead or Alive and Doom have in common?

3 Answers   EA Electronic Arts,


what box testers shouldn't look inside the a. code b. design c. specification d. none of the above

3 Answers  


What is the common risk that leads to project failure?

0 Answers  


Categories