Home >Database >Mysql Tutorial >What is the difference between CHAR and NCHAR in MySQL?

What is the difference between CHAR and NCHAR in MySQL?

WBOY
WBOYforward
2023-09-15 18:09:031327browse

What is the difference between CHAR and NCHAR in MySQL?

CHAR and NCHAR are both fixed-length string data types. They have the following differences-

# Its full name is CHARACTER. Its full name is NATIONAL CHARACTERIt uses the ASCII character set It uses the Unicode character set and data is stored in UTF8 format Each character takes up 1 byte of space. Each character occupies 2 bytes of space
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
CHAR data type

##NCHAR data type

The above is the detailed content of What is the difference between CHAR and NCHAR in MySQL?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete