mysql 建立视图的问题

dinghao517 2012-06-14 11:25:18
drop view if exists info_student;
create view info_student(no,name,age,sex,department,grade)
AS
select no,name,age,sex,department,grade from student
where name = '王澜';
select * from info_student;

这是运行提示
[SQL] drop view if exists info_student;
影响的数据栏: 0
时间: 0.001ms

[SQL]
create view info_student(no,name,age,sex,department,grade)
AS
select no,name,age,sex,department,grade from student
where name = '王澜';
影响的数据栏: 0
时间: 0.016ms

[SQL]
select * from info_student;
[Err] 1267 - Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='


...全文
68 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
wwwwb 2012-06-14
  • 打赏
  • 举报
回复
贴结果
dinghao517 2012-06-14
  • 打赏
  • 举报
回复
show variables like 'char%';
这是什么?不明白。。
wwwwb 2012-06-14
  • 打赏
  • 举报
回复
show variables like 'char%';
dinghao517 2012-06-14
  • 打赏
  • 举报
回复
那该怎么改呢?
drop view if exists info_student;
create view info_student(no,name,age,sex,department,grade)
AS
select no,name,age,sex,department,grade from student
where name like '王澜%';
select * from info_student;
也不对啊

ACMAIN_CHM 2012-06-14
  • 打赏
  • 举报
回复
set names 'gbk';
然后再试一下。
wwwwb 2012-06-14
  • 打赏
  • 举报
回复
字符集问题
show variables like 'char%';
rucypli 2012-06-14
  • 打赏
  • 举报
回复
set names gbk;
drop view if exists info_student;
create view info_student(no,name,age,sex,department,grade)
AS
select no,name,age,sex,department,grade from student
where name like '王澜%';
select * from info_student;

56,687

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧