Joke Collection Website - Cold jokes - Problems with char type in mysql?
Problems with char type in mysql?
Char is a fixed-length type, and varchar is a variable-length type. The difference between them is:
In a data column of type char(M), each Each value occupies M
bytes
. If a length is less than M, MySQL will
right
Complement with space characters. (Padding space characters will be removed during the search operation.) In a varchar(M) type data column, each value only takes up just enough bytes plus one byte to record its length ( That is, the total length is L+1 bytes).
Rules used in MySQL to determine whether column comparison
type conversion
is required
>1. In a
data table
, if the length of each data column is fixed, then the length of each data row will also be fixed.
2. As long as there is a variable length of data column in the data table, then the length of each data row will be variable.
3. If the length of the data rows in a certain data table is variable, then, in order to save
storage space
, MySQL will Fixed-length data columns in the data table are converted into corresponding variable-length types.
Exception: char data columns with a length less than 4 characters will not be converted to varchar type
Hope this helps you
- Related articles
- Funny jokes designed to cure bad moods
- In which episode of Yan Xi Palace, Wei Luoyu sealed the imperial concubine?
- Explanation and sentence making of being law-abiding
- Sun, the all-around star, takes a selfie. What has he experienced during this time?
- A joke that went wrong.
- Can people in the entertainment circle believe what they say?
- Are contemporary young people eager for success?
- What is the official position of Wang Lang's "Situ"? What was its status at the time?
- I want to take care of your qq all my life.
- I can't understand the second chapter of the basic music theory course. Just notes and rests. You can write notes, but you don't know how to use rests.