码迷,mamicode.com
首页 > 其他好文 > 详细

CHARACTER SET

时间:2016-08-13 01:06:04      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:

mysql> show tables;
+-----------------+
| Tables_in_w0811 |
+-----------------+
| t               |
| w_engine        |
| w_engine_b      |
| w_engine_c      |
| w_int           |
+-----------------+
5 rows in set (0.00 sec)

mysql> create table if not exists student
    -> (
    ->  sno int primary key,
    ->  sname VARCHAR(20) CHARACTER SET gbk,
    ->  sage TINYINT,
    ->  shair ENUM(‘黑‘,‘白‘)
    -> );
ERROR 1291 (HY000): Column ‘shair‘ has duplicated value ‘?‘ in ENUM
mysql> insert into student values(‘1‘,‘李强‘,23,‘黑‘);
ERROR 1146 (42S02): Table ‘w0811.student‘ doesn‘t exist
mysql> insert into student values(‘2‘,‘刘丽‘,22,‘白‘);
ERROR 1146 (42S02): Table ‘w0811.student‘ doesn‘t exist
mysql> insert into student values(‘5‘,‘张友‘,22,‘黑‘);
ERROR 1146 (42S02): Table ‘w0811.student‘ doesn‘t exist
mysql> insert into student values(‘53‘,‘张友‘,22,‘额黑‘);
ERROR 1146 (42S02): Table ‘w0811.student‘ doesn‘t exist
mysql> select * from student;
ERROR 1146 (42S02): Table ‘w0811.student‘ doesn‘t exist
mysql>

 

mysql> show tables;
+-----------------+
| Tables_in_w0811 |
+-----------------+
| t               |
| w_engine        |
| w_engine_b      |
| w_engine_c      |
| w_int           |
+-----------------+
5 rows in set (0.00 sec)

mysql> create table if not exists student
    -> (
    ->  sno int primary key,
    ->  sname VARCHAR(20) CHARACTER SET gbk,
    ->  sage TINYINT,
    ->  shair ENUM(‘黑‘,‘白‘) CHARACTER SET gbk
    -> );
Query OK, 0 rows affected (0.01 sec)

mysql> insert into student values(‘1‘,‘李强‘,23,‘黑‘);
Query OK, 1 row affected (0.00 sec)

mysql> insert into student values(‘2‘,‘刘丽‘,22,‘白‘);
Query OK, 1 row affected (0.00 sec)

mysql> insert into student values(‘5‘,‘张友‘,22,‘黑‘);
Query OK, 1 row affected (0.00 sec)

mysql> insert into student values(‘53‘,‘张友‘,22,‘额黑‘);
ERROR 1265 (01000): Data truncated for column ‘shair‘ at row 1
mysql> select * from student;
+-----+-------+------+-------+
| sno | sname | sage | shair |
+-----+-------+------+-------+
|   1 | 李强  |   23 | 黑    |
|   2 | 刘丽  |   22 | 白    |
|   5 | 张友  |   22 | 黑    |
+-----+-------+------+-------+
3 rows in set (0.00 sec)

mysql>

 

mysql> show variables like ‘%set%‘;
+---------------------------------------+---------------------------------------
----------+
| Variable_name                         | Value
          |
+---------------------------------------+---------------------------------------
----------+
| auto_increment_offset                 | 1
          |
| character_set_client                  | gbk
          |
| character_set_connection              | gbk
          |
| character_set_database                | latin1
          |
| character_set_filesystem              | binary
          |
| character_set_results                 | gbk
          |
| character_set_server                  | latin1
          |
| character_set_system                  | utf8
          |
| character_sets_dir                    | D:\wamp64\bin\mysql\mysql5.7.11\sharecharsets\ |
| innodb_monitor_reset                  |
          |
| innodb_monitor_reset_all              |
          |
| optimizer_trace_offset                | -1
          |
| performance_schema_setup_actors_size  | -1
          |
| performance_schema_setup_objects_size | -1
          |
| transaction_write_set_extraction      | OFF
          |
+---------------------------------------+---------------------------------------

 

CHARACTER SET

标签:

原文地址:http://www.cnblogs.com/yuanjiangw/p/5766989.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!