enum只能从集合中选取一个,set可以从集合中任意排列组合
root@localhost:cyz--01:18:01 >create table test(gender enum('M','F'));
Query OK, 0 rows affected (0.01 sec)
root@localhost:cyz--01:18:18 >insert into test values('M'),('m'),('f'),(null);
Query OK, 4 rows affected (0.11 sec)
Records: 4 Duplicates: 0 Warnings: 0
root@localhost:cyz--01:18:46 >select * from test;
+--------+
| gender |
+--------+
| M |
| M |
| F |
| NULL |
+--------+
4 rows in set (0.00 sec)
root@localhost:cyz--01:23:16 >create table test(aaa set('M','F'));
Query OK, 0 rows affected (0.01 sec)
root@localhost:cyz--01:23:25 >insert into test values('M,F'),('m'),('F');
Query OK, 3 rows affected (0.00 sec)
Records: 3 Duplicates: 0 Warnings: 0
root@localhost:cyz--01:23:29 >select * from test;
+------+
| aaa |
+------+
| M,F |
| M |
| F |
+------+
3 rows in set (0.00 sec)