The difference between char and varchar
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.