zoukankan      html  css  js  c++  java
  • mysql的数据类型5---enum与set类型

    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)

    你将来想成为什么样子,就一定会成为什么样子,只要你努力坚持的去做!!!
  • 相关阅读:
    kmp学习笔记(模板)
    最小表示法 (模板)
    Codeforces 1339C
    Codeforces 1339D
    Codeforces 1244C
    Codeforces 1262D2
    Codeforces 1330D
    Problem M. Mediocre String Problem
    Codeforces 1326D2
    selenium读取数据文件
  • 原文地址:https://www.cnblogs.com/kucha/p/4835710.html
Copyright © 2011-2022 走看看