Nuestro grupo de expertos pasados ciertos días de trabajo y recopilar de datos, encontramos la respuesta, esperamos que resulte de gran utilidad en tu proyecto.
Solución:
Si establece una intercalación adecuada para la columna, el valor dentro del campo se comparará naturalmente con su equivalente sin acento.
mysql> SET NAMES 'utf8' COLLATE 'utf8_unicode_ci';
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT 'é' = 'e';
+------------+
| 'é' = 'e' |
+------------+
| 1 |
+------------+
1 row in set (0.05 sec)
Tuve el mismo problema, así que escribí una lista de consultas basada en un script PHP que tengo para eliminar los acentos y hacer URL amigables para SEO:
Tal vez le gustaría agregar otros caracteres especiales, como el $
o £
símbolos …
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Š','S');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'š','s');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ð','Dj');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ž','Z');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ž','z');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'À','A');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Á','A');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Â','A');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ã','A');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ä','A');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Å','A');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Æ','A');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ç','C');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'È','E');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'É','E');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ê','E');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ë','E');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ì','I');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Í','I');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Î','I');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ï','I');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ñ','N');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ò','O');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ó','O');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ô','O');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Õ','O');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ö','O');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ø','O');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ù','U');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ú','U');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Û','U');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ü','U');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ý','Y');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Þ','B');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ß','Ss');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'à','a');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'á','a');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'â','a');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ã','a');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ä','a');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'å','a');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'æ','a');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ç','c');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'è','e');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'é','e');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ê','e');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ë','e');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ì','i');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'í','i');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'î','i');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ï','i');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ð','o');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ñ','n');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ò','o');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ó','o');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ô','o');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'õ','o');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ö','o');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ø','o');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ù','u');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ú','u');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'û','u');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ý','y');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ý','y');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'þ','b');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ÿ','y');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ƒ','f');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'.',' ');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,' ','-');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'--','-');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ě','e');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ž','z');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'š','s');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'č','c');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ř','r');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ď','d');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ť','t');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ň','n');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'ů','u');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ě','E');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ž','Z');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Š','S');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Č','C');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ř','R');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ď','D');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ť','T');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ň','N');
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ů','U');
UPDATE TABLE_NAME SET COLUMN = LOWER(COLUMN);
Comparto esto, tal vez pueda ayudar …:
DELIMITER //
CREATE OR REPLACE FUNCTION `remove_accents`(`str` TEXT)
RETURNS text
LANGUAGE SQL
DETERMINISTIC
NO SQL
SQL SECURITY INVOKER
COMMENT ''
BEGIN
SET str = REPLACE(str,'Š','S');
SET str = REPLACE(str,'š','s');
SET str = REPLACE(str,'Ð','Dj');
SET str = REPLACE(str,'Ž','Z');
SET str = REPLACE(str,'ž','z');
SET str = REPLACE(str,'À','A');
SET str = REPLACE(str,'Á','A');
SET str = REPLACE(str,'Â','A');
SET str = REPLACE(str,'Ã','A');
SET str = REPLACE(str,'Ä','A');
SET str = REPLACE(str,'Å','A');
SET str = REPLACE(str,'Æ','A');
SET str = REPLACE(str,'Ç','C');
SET str = REPLACE(str,'È','E');
SET str = REPLACE(str,'É','E');
SET str = REPLACE(str,'Ê','E');
SET str = REPLACE(str,'Ë','E');
SET str = REPLACE(str,'Ì','I');
SET str = REPLACE(str,'Í','I');
SET str = REPLACE(str,'Î','I');
SET str = REPLACE(str,'Ï','I');
SET str = REPLACE(str,'Ñ','N');
SET str = REPLACE(str,'Ò','O');
SET str = REPLACE(str,'Ó','O');
SET str = REPLACE(str,'Ô','O');
SET str = REPLACE(str,'Õ','O');
SET str = REPLACE(str,'Ö','O');
SET str = REPLACE(str,'Ø','O');
SET str = REPLACE(str,'Ù','U');
SET str = REPLACE(str,'Ú','U');
SET str = REPLACE(str,'Û','U');
SET str = REPLACE(str,'Ü','U');
SET str = REPLACE(str,'Ý','Y');
SET str = REPLACE(str,'Þ','B');
SET str = REPLACE(str,'ß','Ss');
SET str = REPLACE(str,'à','a');
SET str = REPLACE(str,'á','a');
SET str = REPLACE(str,'â','a');
SET str = REPLACE(str,'ã','a');
SET str = REPLACE(str,'ä','a');
SET str = REPLACE(str,'å','a');
SET str = REPLACE(str,'æ','a');
SET str = REPLACE(str,'ç','c');
SET str = REPLACE(str,'è','e');
SET str = REPLACE(str,'é','e');
SET str = REPLACE(str,'ê','e');
SET str = REPLACE(str,'ë','e');
SET str = REPLACE(str,'ì','i');
SET str = REPLACE(str,'í','i');
SET str = REPLACE(str,'î','i');
SET str = REPLACE(str,'ï','i');
SET str = REPLACE(str,'ð','o');
SET str = REPLACE(str,'ñ','n');
SET str = REPLACE(str,'ò','o');
SET str = REPLACE(str,'ó','o');
SET str = REPLACE(str,'ô','o');
SET str = REPLACE(str,'õ','o');
SET str = REPLACE(str,'ö','o');
SET str = REPLACE(str,'ø','o');
SET str = REPLACE(str,'ù','u');
SET str = REPLACE(str,'ú','u');
SET str = REPLACE(str,'û','u');
SET str = REPLACE(str,'ý','y');
SET str = REPLACE(str,'ý','y');
SET str = REPLACE(str,'þ','b');
SET str = REPLACE(str,'ÿ','y');
SET str = REPLACE(str,'ƒ','f');
RETURN str;
END
//
DELIMITER ;
No se te olvide comunicar este escrito si te fue de ayuda.
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)