
On specifying a CHARACTER SET binary attribute for a character string data type, MySQL creates that column as its subsequent binary string type. The conversions for CHAR, VARCHAR and BLOB data types take place as follows −
CHAR would become BINARYVARCHAR would become VARBINARYTEXT would become BLOB
The above kind of conversion does not occur for ENUM and SET data type and they both are created as declared while creating the table.
Example
In the example below we have created a table named ‘EMP’ with four columns all specified as CHARACTER SET binary as follows −
mysql> Create table Emp(Name varchar(10) CHARACTER SET binary, Address CHAR(10)CHARACTER SET binary, Designation TEXT CHARACTER SET binary, Field ENUM('ENG','SS') CHARACTER SET binary);Query OK, 0 rows affected (0.16 sec)
But now on checking the status of table, with the help of query below, we can see that MySQL has changed the data type according to its subsequent binary string.
mysql> Show Create Table EMPG*************************** 1. row *************************** Table: EMPCreate Table: CREATE TABLE `emp` ( `Name` varbinary(10) DEFAULT NULL, `Address` binary(10) DEFAULT NULL, `Designation` blob, `Field` enum('ENG','SS') CHARACTER SET binary DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin11 row in set (0.00 sec)
以上就是当我们为字符串数据类型指定 CHARACTER SET 二进制属性时,MySQL 如何反应?的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/107824.html
微信扫一扫
支付宝扫一扫