Set default character during table definition : CHARSET « I18N « SQL / MySQL






Set default character during table definition

      
mysql>
mysql>
mysql> CREATE TABLE TABUTF8
    ->       (C1   CHAR(10) NOT NULL,
    ->        C2   VARCHAR(10))
    ->    DEFAULT CHARACTER SET utf8
    -> ;
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT   COLUMN_NAME, CHARACTER_SET_NAME
    -> FROM     INFORMATION_SCHEMA.COLUMNS
    -> WHERE    TABLE_NAME = 'TABUTF8';
+-------------+--------------------+
| COLUMN_NAME | CHARACTER_SET_NAME |
+-------------+--------------------+
| C1          | utf8               |
| C2          | utf8               |
+-------------+--------------------+
2 rows in set (0.00 sec)

mysql>
mysql> drop table TABUTF8;
Query OK, 0 rows affected (0.00 sec)

mysql>

   
    
    
    
    
    
  








Related examples in the same category

1.Set DEFAULT CHARSET=latin1
2.The CHARSET() function identifies the character set used for a specified string
3.Get CHARSET
4.Get the charset and collation information
5.Optionally, you can specify a default character set and sort order:
6.Change the Character Set of All Text Columns
7.MySQL Character Set Variables
8.Changing the Character Set
9.Specifying the Character Set of a Character String (Cast Operator)
10.CREATE DATABASE statement specifies the character set and collation:
11.To change the character set to latin1 for the BookSales database, use the following ALTER DATABASE statement
12.CONVERT( USING )
13.Check the character set
14.Check the character set name and description
15.Character setting for char type column
16.CHARACTER SET utf8 for column definition
17.CHARACTER SET 'latin1', CHARACTER SET 'hp8'
18.Check the character set settings
19.Check the default character set name
20.Table with default chartset= latin1;