Home > Database > Mysql Tutorial > body text

In MySQL, when the VARCHAR data type will use 1 byte and when it will use the 2 byte prefixes length and data?length and data?

王林
Release: 2023-08-24 14:45:04
forward
1508 people have browsed it

在 MySQL 中,何时 VARCHAR 数据类型将使用 1 字节,何时使用 2 字节前缀 length 和 data?length 以及 data?

As we all know, in MySQL, VARCHAR values ​​are stored as 1-byte or 2-byte length prefix plus data. The length prefix indicates the number of bytes in the data value. The data value itself will determine when the VARCHAR data type uses a 1-byte prefix length and when a 2-byte prefix length is used.

  • If the value is not required, the column uses 1 byte longer than 255 bytes.
  • If the value may require more than 255 bytes, use a 2-byte length for the column.

The above is the detailed content of In MySQL, when the VARCHAR data type will use 1 byte and when it will use the 2 byte prefixes length and data?length and data?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!