I am normalizing a database in MySQL and I have to convert a field that was entered manually to an FK field that is related to a new table that should have that manual income but without repeating it.
The problem I have is that, being manual income, there are many variations. For example, I have "Auto Rojo"
, "auto Rojo"
, "AUTO rojo "
, etc. and it should only have a single record.
I give an example with data that I am working on:
INSERT INTO corredor (nombre) VALUES ("MARCO ANTONIO ASTUDILLO GHO");
INSERT INTO corredor (nombre) VALUES ("MARCO ANTONIO ASTUDILLO GHO CORREDO");
INSERT INTO corredor (nombre) VALUES ("LILIENFELD CORREDORES DE SEGUROS");
INSERT INTO corredor (nombre) VALUES ("LILIENFELD CORREDORES DE SEGUROS");
INSERT INTO corredor (nombre) VALUES ("FELIPE PAUL");
INSERT INTO corredor (nombre) VALUES ("FELIPE PAUL Y CIA LTDA");
INSERT INTO corredor (nombre) VALUES ("FELIPE PAUL Y CIA. LTDA");
INSERT INTO corredor (nombre) VALUES ("FELIPE PAUL Y CIA. LTDA.");
- I previously grouped and exported as inserts with workbench, of 7000 records were grouped into 400 approx. The idea is that in the final application the user does not write and select from the list (or add if not in it).
What would be a way to clean these fields and reference them from my original table?