What is the difference between CHAR and NCHAR in MySQL?


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

Updated on: 19-Jun-2020

501 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements