Deleting duplicate records based on specific column(s) in Oracle, MySQL and MSSQL

  1. By using Group by and max(primary/unique key) or min(primary/unique key)-delete all records which are not in max(primary/unique key) or min(primary/unique key)
  2. By using self join with delete

Query to find out duplicate records

Oracle/MSSQL delete Query -By using Group by and min/max

MySQL delete Query -By using Group by and maxmin/max

Oracle/MySQL/MSSQL Delete Query -By using self join with delete




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The Known Unknown: Working with Option and Nullable Types

Layouts in Flutter

Journey from Software Developer to Software Architect

Chapter 15 -Networking and Threads: Make a Connection

Streams and Pub-sub systems, why we should love them and how they work in Redis

Deploy Public WordPress site with Private MYSQL Database creating VPC using Terraform

even a resurgence of the coronavirus later this year and next

The PM Journal | Log 06

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sudha Subramaniam

Sudha Subramaniam

More from Medium

Launch a container in docker Further launch a container then install docker in it and again launch…

Inversion Of Control and How Spring achieves IoC

LeetCode 202. Happy Number

Document Understanding in UIPath Part 1