如何在MySQL中设置Year数据类型
|
我无法理解此sql语句出了什么问题
INSERT INTO tbl_car_model_year_rate
SET car_model_id =4,
FROM =2008,
TO =2011,
with_driver =1,
per_day =1000,
ten_days =10000,
twenty_days =20000,
thirty_days =30000,
image = \'1303166512test.jpg\',
created_at = NOW( ) ,
created_by =1
数据类型
car_model_id int(11)
image text
from year(4)
to year(4)
with_driver tinyint(1)
per_day int(11)
ten_days int(11)
twenty_days int(11)
thirty_days int(11)
created_at datetime
created_by int(11)
错误讯息
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 \'from =2008, to =2011, with_driver =1, per_day =1000, ten_days =10000, twenty\' at line 1
没有找到相关结果
已邀请:
4 个回复
博沮富教全
会的。 如果您在反引号\“`\”中添加字段和/或表名,则几乎可以使用任何名称。 失败原因
是保留字(如
) 您通过使用
作为列名(
)来混淆MySQL 我的建议 不要为字段名使用保留字。 将列名从“ 4”更改为“ 11”或“ 12” 从
到
或
。 使用保留字作为列名很容易引起混淆,在所有内容周围加上反引号只会使内容难以阅读和丑陋,同时仍然令人困惑。
徐百晴墓斜
课刊灭似
妊辽剁茧