Mysql的数据类型

Mysql的数据类型有很多,主要可以分为三大类:

数值类型、字符串类型、时间和日期类型。

注意:

一个汉字3个字节(utf-8);2个字节(gbk):

select length(name_adress) from my_test_copy as len; #该列的各个长度,字节,一个汉字3个字节(utf-8);2个字节(gbk),name_adress为列名,my_test_copy为表名

一个英文字符1个字节

select length('hhh') as len;  #一个英文字符1个字节,此结果为3

参考:

https://www.runoob.com/mysql/mysql-data-types.html

原文地址:https://www.cnblogs.com/qi-yuan-008/p/12342780.html