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

The difference between char and varchar

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

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

The length of char is fixed, and the length of varchar is variable.

For example: char (5) varchar (5)

When entering char data: there are 5 characters, numbers and Chinese characters, and only 5 can be entered.

When entering varchar data: there are also 5 characters, numbers and Chinese characters, and only 5 characters can be entered.

On the surface, there is no difference between char and varchar.

In fact, when char enters 1 (character, number, Chinese character), five spaces will be occupied.

When varchar inputs 1 (character, number, Chinese character), it will only take up one space.

The reason why (varchar) variable length calculation is slow, because variable length needs to calculate the string length, but char does not need to calculate.

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

Network Security

Wechat

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

12
Report