- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the use of NCHAR in MySQL?
MySQL defines NCHAR as a way to indicate that a CHAR column should use predefined character set. Utf8 is used by MySQL as its predefined character set.
Example
In the example below, we are creating a table named ‘Student1’. In this table, we are declaring the data types of three columns with three different declaration styles which are rather equivalent of each other. It is all due to NCHAR.
mysql> Create table Student1(Name Char(10) character set utf8, Address NATIONAL CHARACTER(10), FatherName NCHAR(10)); Query OK, 0 rows affected (0.25 sec)
Now on checking the status of table, with the help of query below, we can see that all the declaration styles are same.
mysql> show create table Student1\G *************************** 1. row *************************** Table: Student1 Create Table: CREATE TABLE `student1` ( `Name` char(10) CHARACTER SET utf8 DEFAULT NULL, `Address` char(10) CHARACTER SET utf8 DEFAULT NULL, `FatherName` char(10) CHARACTER SET utf8 DEFAULT NULL ) ENGINE = InnoDB DEFAULT CHARSET = latin1 1 row in set (0.00 sec)
- Related Articles
- What is the difference between CHAR and NCHAR in MySQL?
- What is the use of RLIKE operator in MySQL?
- What is the use of FIND_IN_SET () function in MySQL?
- What is the use of LOCATE() function in MySQL?
- What is the use of MySQL SUBSTRING_INDEX() function?
- What is the use of MySQL UNHEX() function?
- What is the use of MySQL CHAR() function?
- What is the use of MySQL FROM_UNIXTIME() function?
- What is the use of MySQL GET_FORMAT() function?
- What is the use of MySQL LAST_INSERT_ID() function?
- What is the use of MySQL CONCAT_WS() function?
- What is the use of MySQL TRUNCATE() function?
- What is the use of FLUSH PRIVILEGES statement in MySQL?
- What is the use of SOUNDS LIKE operator in MySQL?
- What is the use of ORDER BY clause in MySQL?

Advertisements