zoukankan      html  css  js  c++  java
  • The CHAR and VARCHAR Types

    The CHAR and VARCHAR Types

      The CHAR and VARCHAR types are declared with a length that indicates the maximum number of characters you want to store. For example,CHAR(30) can hold up to 30 characters.

      括号中指定宽度。

      The length of a CHAR column is fixed to the length that you declare when you create the table. The length can be any value from 0 to 255. WhenCHAR values are stored, they are right-padded with spaces to the specified length. When CHAR values are retrieved, trailing spaces are removed unless the PAD_CHAR_TO_FULL_LENGTH SQL mode is enabled.

      CHAR长度为0-255,固定,取值时尾部空格忽略,除非PAD_CHAR_TO_FULL_LENGTH模式被启用。

      Values in VARCHAR columns are variable-length strings. The length can be specified as a value from 0 to 65,535. The effective maximum length of a VARCHAR is subject to the maximum row size (65,535 bytes, which is shared among all columns) and the character set used.

      VARCHAR长度为0-65535,VARCHAR与其它列共享最大长度65535。  

      In contrast to CHARVARCHAR values are stored as a 1-byte or 2-byte length prefix plus data. The length prefix indicates the number of bytes in the value. A column uses one length byte if values require no more than 255 bytes, two length bytes if values may require more than 255 bytes.

      VARCHAR将长度存储在头部,1-2字节。

      

      

    参考:https://dev.mysql.com/doc/refman/5.7/en/char.html

  • 相关阅读:
    几个ID
    一百层高楼和两个棋子
    快速了解的链接 shell sed awk
    用shell实现一个“输入密码”程序
    i love you do you love me
    打造全新视觉环境
    【转】LINUX 环境变量总结
    TextBox输入限制
    获取CPU和硬盘序列号
    Lable属性设置(winform)
  • 原文地址:https://www.cnblogs.com/tekkaman/p/6358723.html
Copyright © 2011-2022 走看看