MySQL - 尝试插入字符串/数字时出现语法错误

标签 mysql sql syntax-error

<分区>

我收到以下错误:

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 '('text','text','text',1,2,3,4,5,6,7,' at line 4

尝试运行此 SQL 命令时:

insert into `table`
VALUES
    (`col1`,`col2`,`col3`,`col4`,`col5`,`col6`,`col7`,`col8`,`col9`,`col10`,`col11`,`col12`,`col13`,`col14`)
    ('text','text','text',1,2,3,4,5,6,7,8,'text','text','text'),
    ('text','text','text',11,12,13,14,15,16,17,18,'text','text','text')

更新:我是个彻头彻尾的白痴,在VALUES之前添加了列名...

最佳答案

insert into `table`
(`col1`,`col2`,`col3`,`col4`,`col5`,`col6`,`col7`,`col8`,`col9`,`col10`,`col11`,`col12`,`col13`,`col14`)    
VALUES
('text','text','text',1,2,3,4,5,6,7,8,'text','text','text'),
('text','text','text',11,12,13,14,15,16,17,18,'text','text','text')

关于MySQL - 尝试插入字符串/数字时出现语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31244125/

相关文章:

Python-属性错误: module 'mysql' has no attribute 'connector'

php - 如何在 OS X 上连接到正确的 MySQL 数据库? (两个 mysqld 实例正在运行)

java - 单条数据库记录插入失败是否需要回滚?

mysql - 我如何扫描一个值变成空而不处理它?

r - 为什么ShinyApps中的seq()函数不起作用?

mysql - 在 mysql JOIN 查询中拆分字段值

php - 将引导日期选择器中的日期插入 MySQL 日期字段不起作用

mysql - 三列合并为一个日期

sql - 无法更新时间戳列

c# - 使用System.Windows;不是名字空间