Mysql nchar Datatype
MySQL nchar define the datatype nchar that stores fixed-length character data. The data can be a string single-byte or multibyte letters, digits and symbols, that can be supported by the code set of the database locale.
Understand with Example
The Tutorial grasp you an example from 'MySQL nchar'. To understand and elaborate an example we create a table 'nchar' that has the required fieldnames and datatypes respectively.
Create table:
mysql> CREATE TABLE nchar ( -> a int, -> b nchar(24), -> c nchar(40) -> ) -> ; Query OK, 0 rows affected (0.06 sec) |
Query for inserting data in the table:
The Query insert into is used to add the records or rows to the table nchar.
mysql> insert into nchar -> values -> (1,'G','T'), -> (2,'K','S'); Query OK, 2 rows affected (0.03 sec) Records: 2 Duplicates: 0 Warnings: 0 |
Query for viewing data of the table:
The select is used to return the records from table nchar.
mysql> select * from nchar; +------+------+------+ | a | b | c | +------+------+------+ | 1 | G | T | | 2 | K | S | +------+------+------+ 2 rows in set (0.00 sec) |
Query for describing data of the table:
The Query desc is used to show the field, type, null etc of the table nchar.
mysql> desc nchar; +-------+----------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+----------+------+-----+---------+-------+ | a | int(11) | YES | | NULL | | | b | char(24) | YES | | NULL | | | c | char(40) | YES | | NULL | | +-------+----------+------+-----+---------+-------+ 3 rows in set (0.01 sec) |