Mega Code Archive

 
Categories / MySQL Tutorial / Data Types
 

If a given value is stored into the CHAR(4) and VARCHAR(4) columns, the trailing spaces of values retrieved from the columns ar

mysql> mysql> CREATE TABLE myTable (v VARCHAR(4), c CHAR(4)); Query OK, 0 rows affected (0.01 sec) mysql> mysql> INSERT INTO myTable VALUES ('ab  ', 'ab  '); Query OK, 1 row affected (0.00 sec) mysql> mysql> SELECT CONCAT('(', v, ')'), CONCAT('(', c, ')') FROM myTable; +---------------------+---------------------+ | CONCAT('(', v, ')') | CONCAT('(', c, ')') | +---------------------+---------------------+ | (ab  )              | (ab)                | +---------------------+---------------------+ 1 row in set (0.00 sec) mysql> mysql> drop table myTable; Query OK, 0 rows affected (0.00 sec) mysql>