Skip to content

Instantly share code, notes, and snippets.

@aurelian
Created June 24, 2009 12:47
Show Gist options
  • Select an option

  • Save aurelian/135225 to your computer and use it in GitHub Desktop.

Select an option

Save aurelian/135225 to your computer and use it in GitHub Desktop.
mysql> create table `tm` ( `name` varchar(255), primary key (`name`)) engine=InnoDB default charset=utf8;
Query OK, 0 rows affected (1.18 sec)
mysql> insert into tm values ('București');
Query OK, 1 row affected (0.01 sec)
mysql> insert into tm values ('Bucuresti');
ERROR 1062 (23000): Duplicate entry 'Bucuresti' for key 1
mysql> delete from tm;
Query OK, 1 row affected (0.00 sec)
mysql> alter table tm modify `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Query OK, 0 rows affected (0.46 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> insert into tm values ('București');
Query OK, 1 row affected (0.01 sec)
mysql> insert into tm values ('Bucuresti');
ERROR 1062 (23000): Duplicate entry 'Bucuresti' for key 1
mysql> create table `tm` (
`id` int(11) auto_increment,
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
primary key (`id`))
engine=InnoDB CHARACTER SET utf8 COLLATE utf8_unicode_ci default charset=utf8;
Query OK, 0 rows affected (0.36 sec)
mysql> insert into tm (`name`) values ('București');
Query OK, 1 row affected (0.05 sec)
mysql> insert into tm (`name`) values ('Bucuresti');
Query OK, 1 row affected (0.00 sec)
mysql> select * from tm where name='Bucuresti'\G
*************************** 1. row ***************************
id: 1
name: București
*************************** 2. row ***************************
id: 2
name: Bucuresti
2 rows in set (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment