Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql #1054-未知列';id';在';字段列表';_Mysql - Fatal编程技术网

Mysql #1054-未知列';id';在';字段列表';

Mysql #1054-未知列';id';在';字段列表';,mysql,Mysql,您应该使用ID作为主键,并且您的表是否将“ID”作为字段 INSERT INTO `brands` (`id`, `brand_name`, `brand_status`, `created_at`, `updated_at`) VALUES (1, 'Tata', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), (2, 'Ford', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'),

您应该使用ID作为主键,并且您的表是否将“ID”作为字段

INSERT INTO `brands` (`id`, `brand_name`, `brand_status`, `created_at`, `updated_at`) 
VALUES 
(1, 'Tata', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(2, 'Ford', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(3, 'Maruti', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(4, 'Honda', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(5, 'Hyundai', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(6, 'Volkswagen', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(7, 'Mahindra', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(8, 'Skoda', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(9, 'Renault', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(10, 'Fiat', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(11, 'Toyota', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(12, 'Nissan', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(13, 'Chevrolet', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
(14, 'Mitsubishi ', 0, '2013-12-05 13:30:00', '201[...]

如果您的
id
列是自动递增的,那么您不需要在insert查询中放入
id

试试这个

 INSERT INTO `brands` (`brand_name`, `brand_status`, `created_at`, `updated_at`) 
VALUES 
('Tata', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
('Ford', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
('Maruti', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
('Honda', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
('Hyundai', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
('Volkswagen', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
('Mahindra', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
('Skoda', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
('Renault', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
[...]

使用
\uu,尝试将id\uu更改为
id`您的数据库架构看起来像什么?
INSERT INTO `brands` ( `brand_name`, `brand_status`, `created_at`, `updated_at`) 
VALUES 
('Tata', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
('Ford', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
( 'Maruti', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
( 'Honda', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
( 'Hyundai', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
('Volkswagen', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
( 'Mahindra', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
( 'Skoda', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
( 'Renault', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
( 'Fiat', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
( 'Toyota', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
( 'Nissan', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
( 'Chevrolet', 0, '2013-12-05 13:30:00', '2013-12-05 13:30:00'), 
( 'Mitsubishi ', 0, '2013-12-05 13:30:00', '201[...]