即将拔掉我的头发。弗兰基说错误说我“缺少右括号”。见下文:
INSERT INTO storelocals (id, name, address, lat, lng)
values(Frankie Johnnie & Luigo Too,"939 W El Camino Real, Mountain View,CA",37.386339,-122.085823
Amici's East Coast Pizzeria,"790 Castro St, Mountain View, CA",37.38714,-122.083235
Kapp's Pizza Bar & Grill,"191 Castro St, Mountain View, CA",37.393885,-122.078916
Round Table Pizza: Mountain View,"570 N Shoreline Blvd, Mountain View, CA",37.402653,-122.079354
Tony & Alba's Pizza & Pasta,"619 Escuela Ave, Mountain View, CA",37.394011,-122.095528
Oregano's Wood-Fired Pizza,"4546 El Camino Real, Los Altos, CA",37.401724,-122.114646
Round Table Pizza: Sunnyvale-Mary-Central Expy,"415 N Mary Ave, Sunnyvale, CA",37.390038,-122.042034
Giordano's,"730 N Rush St, Chicago, IL",41.895729,-87.625411
Filippi's Pizza Grotto,"1747 India St, San Diego, CA",32.723831,-117.168326
Pizzeria Paradiso,"2029 P St NW, Washington, DC",38.90965,-77.0459
Tutta Bella Neapolitan Pizzera,"4918 Rainier Ave S, Seattle, WA",47.557704,-122.284985
Touche Pasta Pizza Pool,"1425 NW Glisan St, Portland, OR",45.526465,-122.68558
Piecora's New York Pizza,"1401 E Madison St, Seattle, WA",47.614005,-122.313985
Pagliacci Pizza,"550 Queen Anne Ave N, Seattle, WA",47.623942,-122.356719
Zeeks Pizza - Phinney Ridge,"6000 Phinney Ave N, Seattle, WA",47.67267,-122.354092
答案 0 :(得分:1)
您需要在插入的每组值(每行)周围填充,并且需要将字符串文字括在引号中。
要插入单行,请将值括在打开和关闭paren中,例如
INSERT INTO storelocals (name, address, lat, lng) VALUES
('Frankie Johnnie & Luigo Too',"939 W El Camino Real, Mountain View, CA",37.386339,-122.085823)
要插入多行,请用逗号分隔行(我认为它基本上用每个后续行之前的逗号替换第一行(INSERT ... VALUES
行):
INSERT INTO storelocals (name, address, lat, lng) VALUES
('Frankie Johnnie & Luigo Too',"939 W El Camino Real, Mountain View, CA",37.386339,-122.085823)
,
('Amici''s East Coast Pizzeria',"790 Castro St, Mountain View, CA",37.38714,-122.083235)
,
('Kapp''s Pizza Bar & Grill',"191 Castro St, Mountain View, CA",37.393885,-122.078916)
请注意,空格(例如新行字符)不会影响语句,我只是添加了新行字符以更好地展示语法。请注意每个"行"周围的开关位置。数据,并注意单引号括起来的字符串文字中的单引号需要"转义"通过额外的单引号预先添加。例如,字符串文字:
'Amici''s'
评估值为
Amici's
修改强>
INSERT语句中的列列表必须与为该行提供的值列表相匹配。 (第一行值进入第一列,第二行进入第二列,等等。
在OP语句中,似乎没有为引用的id
列提供值。
因此,应该从列列表中删除对id
列的引用。或者,值列表需要包含该列的值。关键字NULL
可用于指定" null"值。
答案 1 :(得分:0)
你实际上错过了右括号......只需在最后添加它。
);