February 2018
Intermediate to advanced
510 pages
16h 10m
English
The CHAR data type is a fixed-length string data type in MySQL. The CHAR data type is often declared with a maximum number of characters that can be stored as follows:
data CHAR(20);
In the preceding example, the data column can store string values that are capable of storing maximum characters.
CHAR and VARCHAR are similar in many ways, with certain differences. The CHAR data type is preferred if the string values to be stored are of fixed size. It will give better performance compared to if VARCHAR is used for fixed size strings.
The lengths vary from 0 to 255. The value in the CHAR column cannot exceed the maximum length declared at the time of table creation. If the length of the string is less than the maximum ...
Read now
Unlock full access