• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 582
  • Last Modified:

Primary Key in MySql with Accents, false duplicates

Hello everyone,

I am currently migrating a database to a mysql database, but there are errors, false duplicates when there are logins like "Cesar" and then "César" after. Mysql finds Cesar and César to be the same thing, so the migration cannot be done property.

Any idea or solution about this?
0
LeGrandi
Asked:
LeGrandi
  • 2
  • 2
  • 2
2 Solutions
 
Aleksandar BradarićSoftware DeveloperCommented:
Try defining the CHARACTER SET for the column, like this:
mysql> SHOW CREATE TABLE cesar1;
+--------+------------------------------------------------------------------------------------------------------------------------------------------+
| Table  | Create Table                                                                                                                             |
+--------+------------------------------------------------------------------------------------------------------------------------------------------+
| cesar1 | CREATE TABLE `cesar1` (
  `name` varchar(100) CHARACTER SET utf8 NOT NULL,
  PRIMARY KEY (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 | 
+--------+------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT * FROM cesar1;
+--------+
| name   |
+--------+
| César | 
| Cesar  | 
+--------+
2 rows in set (0.00 sec)

Open in new window

0
 
profyaCommented:
You are using incorrect charset, use utf8 for Unicode or another supporting your language.
0
 
LeGrandiAuthor Commented:
Actually the problem was in the COLLATE option. Every case insensitive collate option in mySQL, or at least in th version I am using, is also "accent insensitive". The solution was using UTF8_BIN collate.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
profyaCommented:
I have guided to the solution, utf8 solved the problem. I desrve points for the help I have provided. The question was neglected.
0
 
Aleksandar BradarićSoftware DeveloperCommented:
I also object - I was the first to reply and my info certainly was helpful. Why would you want to delete the question?!
0
 
LeGrandiAuthor Commented:
Well, the question was not neglected, but of course I have given you points.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now