posts - 431,  comments - 344,  trackbacks - 0

CREATE TABLE students(
    name VARCHAR(10)
);
mysql查询默认是不区分大小写的 如:
select * from students where name like 'a%'
select * from students where name like 'A%'
效果是一样的。
要让mysql查询区分大小写,可以:
select * from students where binary name like 'a%'
select * from students where binary name like 'A%'

另一种办法是在数据库设计的时候,可能需要大小写敏感,解决方法是建表时候使用BINARY标示。
CREATE TABLE students(
    name VARCHAR(10) BINARY
);


如果修改已经存在的字段,使用如下SQL语句:
alter table ecs_users change user_name user_name varchar(60) binary default '' not null
posted on 2008-12-10 20:32 周锐 阅读(1274) 评论(0)  编辑  收藏 所属分类: MySQL

只有注册用户登录后才能发表评论。


网站导航: