Keeping the objective of making the Oracle Database as a repository of information that can help us with our demands, I will post yet another simple but functional information that is how we discover duplicate records in the database.
Sometimes we need to find out, for example, if we have the same CPF / CNPJ duplicate in our base, and we should have only one record of it.
And, how do I figure it out directly in the database?
I’ll put the query below. See how simple it is and adapt to your reality.
Here’s the query that will help us find duplicate CPFs in the database.
SELECT CPF, COUNT (1)
FROM employees
GROUP BY CPF HAVING COUNT (1)> 1;
Note that the CPF should be the key to your table, okay.
That’s it folks. Doubts? Contact.
Strong hug.
Eduardo Santana
bufallos@bufallos.com.br