CREATE TABLE t_user
( id int AUTO_INCREMENT not null primary key ,
account char ,
password varchar(20) ,
type int ,
name varchar(30) ,
sex char ,
college varchar ,
teacher char,
);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '
teacher char
)' at line 8
出现这个错误,不知道哪里出了问题。

解决方案 »

  1.   

    ( id int AUTO_INCREMENT not null primary key ,
    account char ,
    password varchar(20) ,
    type int ,
    name varchar(30) ,
    sex char ,
    college varchar ,
    teacher char
    );多了个逗号 teacher char,[align=center]====  ====
    [/align]
      

  2.   

    char 默认是char(1)
    varchar 没有默认。
    如果不出错的话CREATE TABLE t_user
    ( id int AUTO_INCREMENT not null primary key ,
    account char,
    `password` varchar(20) ,
    `type` int,
    `name` varchar(30),
    sex char ,
    college varchar(255),
    teacher char
    ); 
      

  3.   

    college varchar->college varchar(50)