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 '='

解决方案 »

  1.   

    字符集问题
    show variables like 'char%'; 
      

  2.   

    set names 'gbk';
    然后再试一下。
      

  3.   

    那该怎么改呢?
    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;
    也不对啊
      

  4.   

    show variables like 'char%';
      

  5.   

    show variables like 'char%';
    这是什么?不明白。。
      

  6.   

    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;