Search code examples
mysqlnvarchar

Why MYSQL Desc command showing char instead of nchar?


I have created two columns in a tables with NATIONAL VARCHAR Data Type? But, when i am running the command, desc The result shows the datatype as varchar, not nvarchar. Why is it so? Am i doing some thing wrong?

PENAME NATIONAL VARCHAR(255),
PNAME NATIONAL VARCHAR(255) NOT NULL,

Solution

  • MySQL does not have separation of nvarchar and varchar (like SQL Server).

    Instead, you define the CHARACTER SET (aka CHARSET) to describe the data (ansi, utf8 etc) therein. This is orthoganal to collation in MySQL (collation defines how the data is sorted and compared)

    NATIONAL VARCHAR (n) is just a synonym for VARCHAR (n) CHARACTER SET utf8