Before MySQL 4.1, NCHAR
and
CHAR
were synonymous. Standard
SQL defines NCHAR
or
NATIONAL CHAR
as a way to
indicate that a CHAR
column
should use some predefined character set. MySQL 4.1 and up
uses utf8
as that predefined character set.
For example, these data type declarations are equivalent:
CHAR(10) CHARACTER SET utf8 NATIONAL CHARACTER(10) NCHAR(10)
As are these:
VARCHAR(10) CHARACTER SET utf8 NATIONAL VARCHAR(10) NCHAR VARCHAR(10) NATIONAL CHARACTER VARYING(10) NATIONAL CHAR VARYING(10)
You can use
N'
(or
literal
'n'
) to
create a string in the national character set. These
statements are equivalent:
literal
'
SELECT N'some text'; SELECT n'some text'; SELECT _utf8'some text';
User Comments
Add your own comment.