Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the characteristics of varchar data types in MySQL database

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the characteristics of varchar data type in MySQL database, which is very detailed and has certain reference value. Friends who are interested must finish reading it.

VARCHAR (M) is a more flexible data type than CHAR and is also used to represent character data, but VARCHAR can save strings of variable length. Where M represents the maximum length of the string allowed to be saved by the data type, as long as the length is less than the maximum value, the string can be saved in the data type.

Therefore, it is more sensible to use the VARCHAR data type for data objects that are difficult to estimate the exact length.

Before MySQL4.1, the maximum length supported by the VARCHAR data type was 255 and above 5.0, which supported 65535 bytes, and a maximum of 21843 characters (not empty) under utf8 encoding.

Characteristics of varchar

1. Use takes up less storage space than fixed-length types (char) (except for MyISAM tables created using ROW_FORMAT=FIXED).

2. Use extra 1-2 bytes to store value length, column length

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report