错误代码:1136。列计数与值计数不匹配

时间:2019-02-20 12:31:58

标签: mysql

DROP TABLE IF EXISTS preventive_maintenance;

-- create table
CREATE TABLE `preventive_maintenance` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `device_type` varchar(11) NOT NULL,
  `device_serial` varchar(20) NOT NULL,
  `customer_name` varchar(20) NOT NULL,
  `error_code` varchar(20) NOT NULL,
  `resolutiom` varchar(20) NOT NULL,
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;

INSERT INTO `preventive_maintenance`
    (`device_type`,`device_serial`,`customer_name`,`error_code`,`resolutiom`,`timestamp`)
VALUES
    ('a1','02598352','Dr. Wonda','35','Power','Over Heat',now());

我知道

Error Code: 1136. Column count doesn't match value count

2 个答案:

答案 0 :(得分:0)

您的值列比插入列还多-两个值都为6

void

答案 1 :(得分:0)

与指定的列相比,INSERT查询中的值更多。

6列:

( device_type , device_serial ,客户名称,错误代码,解析度,时间戳)

但有7个值:

('a1','02598352','Dr. Wonda','35','Power','Over Heat',now());