What is the difference between CHAR and NCHAR in MySQL?

MySQLMySQLi Database

Both CHAR and NCHAR are fixed length string data types. They have the following differences −

CHAR Data Type
NCHAR Data Type
Its full name is CHARACTER.
Its full name is NATIONAL CHARACTER
It uses ASCII character set
It uses Unicode character set and data is stored in UTF8 format
It occupies 1-byte of space for each character.
It Occupies 2-bytes of space for each character
mysql>create table hello1(name CHAR(20));
Query OK, 0 rows affected (0.15
mysql>create table hello(name NCHAR(20));
Query OK, 0 rows affected (0.61
raja
Published on 19-Feb-2018 10:20:30
Advertisements