Mysql char数据类型尾部去空格

char数据类型尾部去空格

create table db_name(name char(10)) engine=myisam;
insert into db_namevalues("abcde"), ("abcde    "), ("    abcde"), ("  abcde  ");

mysql> select name, length(name) from myiasm_char;
+-----------+--------------+
| name      | length(name) |
+-----------+--------------+
| abcde     |            5 |
| abcde     |            5 |
|     abcde |            9 |
|   abcde   |            7 |
+-----------+--------------+
4 rows in set (0.00 sec)


InnoDB也一样

你可能感兴趣的:(sql,mysql)