If I add both then the uniqueness constraints fail, even though my field is in UTF-8. What can be done? I'm running 5.5.16
mysql> show create table foo_person;
+------------+------------------------------------------------+
| Table | Create Table |
+------------+------------------------------------------------+
| foo_person | CREATE TABLE `foo_person` (
`name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci |
+------------+------------------------------------------------+
mysql> INSERT INTO foo_person (`name`) VALUES ('resumé');
Query OK, 1 row affected (0.01 sec)
mysql> INSERT INTO foo_person (`name`) VALUES ('resume');
ERROR 1062 (23000): Duplicate entry 'resume' for key 'PRIMARY'
mysql> select * from foo_person;
+---------+
| name |
+---------+
| resumé |
+---------+
1 row in set (0.00 sec)
namecolumn. – ypercubeᵀᴹ Aug 10 '13 at 09:16SELECT * FROM foo_person WHERE name='resume'would return 2 results. Which is unwanted since they are two different words. – Kit Sunde Aug 10 '13 at 09:25VARCHARcolumn and it's equally fast and it actually saves me space on additional column forid. – Fr0zenFyr Aug 13 '13 at 08:18INTmaybe8 or 10 byteswill hardly give any benefit overVARCHAR(15). Here I save space on a column for surrogate key onidand hardly lose any on the index size. By the way, I sayVARCHAR(15)because in my case its patent number. Of course, there will be considerable difference if I use a longVARCHAR, say100 bytes, that wouldn't make any sense. – Fr0zenFyr Aug 14 '13 at 09:36