大文字/小文字を混ぜ合わせてCHARのテーブルとBINARYのテーブルに
データをINSERTしてCOUNTなどで結果を比較。

TABLE CREATE WITH CHAR


mysql> desc ENGLISH;
+-------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+----------+------+-----+---------+-------+
| name | char(10) | YES | | NULL | |
+-------+----------+------+-----+---------+-------+
1 row in set (0.00 sec)

mysql> select * from ENGLISH;
+---------+
| name |
+---------+
| English |
| english |
| ENGLISH |
| eNgLiSh |
+---------+
4 rows in set (0.00 sec)

mysql> select distinct name from ENGLISH;
+---------+
| name |
+---------+
| English |
+---------+
1 row in set (0.00 sec)

mysql> select name,count(*) from ENGLISH group by name;
+---------+----------+
| name | count(*) |
+---------+----------+
| English | 4 |
+---------+----------+
1 row in set (0.00 sec)

char_table

TABLE CREATE WITH BINARY


mysql> desc ENGLISH_BIN;
+-------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------+------+-----+---------+-------+
| name | binary(10) | YES | | NULL | |
+-------+------------+------+-----+---------+-------+
1 row in set (0.00 sec)

mysql> select * from ENGLISH_BIN;
+------------+
| name |
+------------+
| English |
| english |
| ENGLISH |
| eNgLiSh |
+------------+
4 rows in set (0.00 sec)

mysql> select distinct name from ENGLISH_BIN;
+------------+
| name |
+------------+
| English |
| english |
| ENGLISH |
| eNgLiSh |
+------------+
4 rows in set (0.00 sec)

mysql> select name,count(*) from ENGLISH_BIN group by name;
+------------+----------+
| name | count(*) |
+------------+----------+
| ENGLISH | 1 |
| English | 1 |
| eNgLiSh | 1 |
| english | 1 |
+------------+----------+
4 rows in set (0.00 sec)

binary_table

Comments are closed.

Post Navigation