Categories
SQL / MySQL Tips and Tutorials

MySQL: Find Duplicate Entry / Rows / Records

A quick tip – I kind of have the feeling that I’ve covered this before, but whatever – well, just the simple SQL query below will do:

CREATE TABLE temp SELECT id, COUNT(id) FROM `book` GROUP BY isbn, subject HAVING COUNT(id) > 1

Wherein each combination of column isbn and column subject in each of the rows from table book should be unique and you want to find out those duplicate ones. You can simply select without creating a temporary table to store the duplicates, but this would come handy when the book table has like 1 million records.

To do more by not just finding duplicate records but also extracting the unique ones, read this.

By Yang Yang

Hello, I'm Yang. I build online businesses that please people. Want to join in and post some useful articles on Kavoir.com? Shoot me a message.