下面的SQL语法哪里错了?怎样改正?
问题描述:
下面的SQL语法哪里错了?怎样改正?
create table catch_dedecms
(id int auto_increment primary key,
litpic varchar,
litpic_path varchar,
title varchar,
area varchar,
language varchar,
year int,
director varchar,
actor varchar);
报错:
ERROR 1064 (42000):You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the r
ight syntax to use near '
litpic_path varchar,
title varchar,
area varchar,
language varchar,
y' at line 3
答
您的varchar没有设定最大长度.varchar是可变的,所以必须要设定长度.create table catch_dedecms(id int auto_increment primary key,litpic varchar(200),litpic_path varchar(200),title varchar(200),area varchar...这里的200是什么意思?200是最大长度,如果你存储的内容不够200,则以实际长度为准。char是固定长度,不够以空格补满。