查看字段编码:
show full columns from t2;show variables like ‘%character%‘;show variables like ‘collation_%‘;show variables like ‘character_set_%‘;
修改库字符集:
alter database test character set gbk;
修改表字符集:
alter table t1 character set gbk;
修改字段字符集:
alter table t2 change name name varchar(50) character set gbk not null;
中文排序:
select id ,name from t2 where id > 10 order by convert(name using gbk ) desc;
时间: 2024-10-17 16:55:29