mysql> create table entries
(
   id                   int not null,
   cat_id               tinyint,
   dateposted           datetime,
   subject              varchar,
   body                 text,
   primary key (id)
);
1064 - 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 '
   body                 text,
   primary key (id)
)' at line 6   
这是什么原因

解决方案 »

  1.   

    mysql> create table entries
        -> (
        ->    id                   int not null auto_increment,
        ->    cat_id               tinyint,
        ->    dateposted           datetime,
        ->    subject              varchar(10),
        ->    body                 text,
        ->    primary key (id)
        -> );
    Query OK, 0 rows affected (0.02 sec)
      

  2.   

    varchar() 的语法格式如此。