error msg:
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 'values('name','url','address','city','state','zip','phone'), values('name','url' at line 3
create table:
create table lawyer_info
(firm_name varchar(100) not null,
firm_url varch开发者_如何学运维ar(100) not null,
firm_address varchar(100) not null,
firm_city varchar(100) not null,
firm_state varchar(100) not null,
firm_zip varchar(12) not null,
firm_phone varchar(15) not null);
data:
insert into lawyer_info firm_name,firm_url,firm_address,firm_city,firm_state,firm_zip,firm_phone)
values('name','url','address','city','state','zip','phone'),
values('name','url','address','city','state','zip','phone'),
values('name','url','address','city','state','zip','phone'),
values('name','url','address','city','state','zip','phone'),
values('name','url','address','city','state','zip','phone'),
values('name','url','address','city','state','zip','phone'),
values('name','url','address','city','state','zip','phone');
MySQL's bulk insert syntax doesn't require VALUES every time:
INSERT INTO lawyer_info
(firm_name,firm_url,firm_address,firm_city,firm_state,firm_zip,firm_phone)
VALUES ('name','url','address','city','state','zip','phone'),
('name','url','address','city','state','zip','phone'),
('name','url','address','city','state','zip','phone'),
('name','url','address','city','state','zip','phone'),
('name','url','address','city','state','zip','phone'),
('name','url','address','city','state','zip','phone'),
('name','url','address','city','state','zip','phone');
You forgot to wrap your column list in ( and as already mentioned remove the unnecessary values keyword. Try this:
insert into lawyer_info (firm_name,firm_url,firm_address,firm_city,firm_state,firm_zip,firm_phone)
values('name','url','address','city','state','zip','phone'),
('name','url','address','city','state','zip','phone'),
('name','url','address','city','state','zip','phone'),
('name','url','address','city','state','zip','phone'),
('name','url','address','city','state','zip','phone'),
('name','url','address','city','state','zip','phone'),
('name','url','address','city','state','zip','phone');
you don't need to name the columns. Just:
insert into lawyer_info
values('name','url','address','city','state','zip','phone'),
('name','url','address','city','state','zip','phone');
精彩评论