mysql数据库——字符类型

-- 字符类型
-- CHAR(定长字符串),VARCHAR(变长字符串),
-- TEXT(一个较大块文本数据,不区分大小写,非二进制的),
-- BLOB(超过范围的就会被自动截断,区分大小写,二进制的);可以添加TINY,LONG等修饰
-- varbinary(二进制可变长度字符串),
-- enum(枚举,多个字符的选择,只能选择其中的一个),set(插入一个或多个)
create table table_string (charstring char(10));

select * from table_string;

insert into table_string values ('Hello!','M','A,b,c,d');-- 不区分大小写
insert into table_string values ('Hello!','M');-- 不区分大小写
alter table table_string change charstring charstring char(10) binary; 
-- binary变成存储二进制的一栏,则会区分大小写
alter table table_string add gender enum('M','N');
alter table table_string add setcol set('A','b','c','d');

select * from table_string where charstring = 'hello!';







猜你喜欢

转载自blog.csdn.net/hhyiyuanyu/article/details/80977716