Over a million developers have joined DZone.

Find Duplicate records in SQL table

· Database Zone

Build fast, scale big with MongoDB Atlas, a hosted service for the leading NoSQL database. Try it now! Brought to you in partnership with MongoDB.


U might have come across a situation like there are number of duplicated records in a table.

Now Its Ur duty to remove duplicacy of data from the table, So the first step would be to find out duplicate records against each column.

Suppose our tablename is masterorder with column orderid for which we are goin to find duplicate records.
SELECT orderid, COUNT(*) TotalCount
FROM masterorder
GROUP BY orderid
HAVING COUNT(*) > 1

Now it's easier than ever to get started with MongoDB, the database that allows startups and enterprises alike to rapidly build planet-scale apps. Introducing MongoDB Atlas, the official hosted service for the database on AWS. Try it now! Brought to you in partnership with MongoDB.

Topics:
database

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}