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
Release: 2023-09-15 18:09:03
forward
1326 people have browsed it

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
Copy after login
mysql>create table hello(name NCHAR(20));
Query OK, 0 rows affected (0.61
Copy after login
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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template