zoukankan      html  css  js  c++  java
  • mysql的数据类型4---字符串类型

    mysql中的字符串类型包括char、varchar、blob、text、enum、set类型

    1、char和varchar类型:

    字符串类型(M),其中M值得是所占用的字符数,varchar中是M+1字节

    char可以是0-255任何值,vrachar可以是0-255(5.0.3之前)和0-65535(5.0.3之后)的值,在检索时,char会删除尾部的空格,而varchar会保留这些,如下实验:

    root@localhost:cyz--01:11:14 >create table test(a char(10),b varchar(10));
    Query OK, 0 rows affected (0.02 sec)

    root@localhost:cyz--01:11:15 >insert into test values('ab ','ab ');
    Query OK, 1 row affected (0.00 sec)

    root@localhost:cyz--01:11:28 >select * from test;
    +------+-------+
    | a | b |
    +------+-------+
    | ab | ab |
    +------+-------+
    1 row in set (0.00 sec)

    root@localhost:cyz--01:11:32 >select length(a) a,length(b) b from test;
    +------+------+
    | a | b |
    +------+------+
    | 2 | 5 |
    +------+------+
    1 row in set (0.11 sec)

    你将来想成为什么样子,就一定会成为什么样子,只要你努力坚持的去做!!!
  • 相关阅读:
    android.animation(6)
    android.animation(5)
    android.animation(4)
    android.animation(3)
    android.animation(2)
    android.animation(1)
    android.view.animation(2)
    php热身2:CRUD with Ajax
    PHP热身
    Android热身:通过网络获取资源并更新UI组件
  • 原文地址:https://www.cnblogs.com/kucha/p/4834399.html
Copyright © 2011-2022 走看看