Query to list out the duplicate rows in a table?
Suppose the table is as follows :
id name age 1 deepak 23 2 ankit 23 3 sharma 24 4 kaushal 25 5 Akumar 26 6 Bkumar 30 7 Ckumar 26 8 Dkumar 23 9 deepak 30
You can write the query for retrieving the duplicate records in the above table as follows :
SELECT age FROM employee GROUP BY age HAVING COUNT(*)>1
The above query will return the records of age which are entered multiple times i.e. there are duplicate records of age in the employee table