MySQL - Differentiate between CHAR and VARCHAR in MySQL

Differentiate between CHAR and VARCHAR in MySQL.

CHAR stores the data or values in fixed length format. If the size of the string is smaller than the specified length, it is padded with space characters to match with the length.

On the other hand, VARCHAR stores data in variable length format without any padding. One or two extra bytes are added to store the length.

Example

we have a data type-
CHAR(4);
String abc will be stored as 4 bytes.
VARCHAR(4)
String abc will be stored in 3 bytes.
MySQL - Differentiate between CHAR and NCHAR.
Differentiate between CHAR and NCHAR - CHAR is commonly referred to as character while NCHAR is referred to as NATIONAL CHARACTER......
MySQL - What are date and time data types supported in MySQL?
What are date and time data types supported in MySQL? - MySQL supports the following date and time data types......
MySQL - IN Conditions and LIKE Conditions in MySQL
IN Conditions and LIKE Conditions in MySQL - IN condition is used to match specified values in a query......
Post your comment