MySQL语法错误,无法搞清楚

时间:2013-09-28 05:20:25

标签: mysql syntax-error

我有以下MySQL语句将大量数据插入到表中的许多列中:

INSERT INTO survey (lang,check,lname,fname,age,dob,dlang1,dlang2,dlang3,dlang4,dlang5,alang1,alang2,alang3,alang4,alang5,expperc1,expperc2,expperc3,expperc4,expperc5,readperc1,readperc2,readperc3,readperc4,readperc5,speakperc1,speakperc2,speakperc3,speakperc4,speakperc5,culture1,culture2,culture3,culture4,culture5,eduyears,eduother,immi, ...

当我尝试运行语句时出现以下错误:

  

错误1064(42000):您的SQL语法有错误;检查   手册,对应右边的MySQL服务器版本   在'“INSERT INTO调查附近使用的语法   (lang,check,lname,fname,age,dob,dlang1,dlang2,dlang3,dlang4,'at line   1

我认为要将数据插入到特定的列中,我应该列出()中的所有列名,就像我已经完成的那样。我在这里错过了什么吗?

作为参考,这里是完整的陈述,虽然在大多数情况下应该已经达到了语法错误,对吗?

INSERT INTO survey (lang,check,lname,fname,age,dob,dlang1,dlang2,dlang3,dlang4,dlang5,alang1,alang2,alang3,alang4,alang5,expperc1,expperc2,expperc3,expperc4,expperc5,readperc1,readperc2,readperc3,readperc4,readperc5,speakperc1,speakperc2,speakperc3,speakperc4,speakperc5,culture1,culture2,culture3,culture4,culture5,eduyears,eduother,immi,emi,correction,level1,ageacq1,agefluent1,ageread1,agereadf1,ycountry1,mcountry1,yfamily1,mfamily1,yschool1,mschool1,speak1,understand1,read1,learnfriends1,learntapes1,learnfamily1,learntv1,learnread1,learnradio1,expofriends1,exporadio1,expofamily1,exporead1,expotv1,expotapes1,accent1,level2,ageacq2,agefluent2,ageread2,agereadf2,ycountry2,mcountry2,yfamily2,mfamily2,yschool2,mschool2,speak2,understand2,read2,learnfriends2,learntapes2,learnfamily2,learntv2,learnread2,learnradio2,expofriends2,exporadio2,expofamily2,exporead2,expotv2,expotapes2,accent2,comb_str,comb_time,wrench_str,wrench_time,snowman_str,snowman_time,raccoon_str,raccoon_time,watch_str,watch_time,horse_str,horse_time,church_str,church_time,iron_str,iron_time,wateringcan_str,wateringcan_time,stroller_str,stroller_time,saw_str,saw_time,wolf_str,wolf_time,stove_str,stove_time,donkey_str,donkey_time,anchor_str,anchor_time,boot_str,boot_time,needle_str,needle_time,pillar_str,pillar_time,thimble_str,thimble_time,window_str,window_time,pencil_str,pencil_time,squirrel_str,squirrel_time,cup_str,cup_time,clothespin_str,clothespin_time,ball_str,ball_time,penguin_str,penguin_time,cow_str,cow_time,salt_str,salt_time,tiger_str,tiger_time,icecreamcone_str,icecreamcone_time,sink_str,sink_time,spider_str,spider_time,cloud_str,cloud_time,fan_str,fan_time,tweezers_str,tweezers_time,pen_str,pen_time,ant_str,ant_time,caterpillar_str,caterpillar_time,spoon_str,spoon_time,pipe_str,pipe_time,snake_str,snake_time,lips_str,lips_time,sword_str,sword_time,palmtree_str,palmtree_time,barn_str,barn_time,orange_str,orange_time,cat_str,cat_time,flower_str,flower_time,apple_str,apple_time,wood_str,wood_time,grasshopper_str,grasshopper_time,leopard_str,leopard_time,lightswitch_str,lightswitch_time,onion_str,onion_time,washingmachine_str,washingmachine_time,nose_str,nose_time,seahorse_str,seahorse_time,windmill_str,windmill_time,sun_str,sun_time,toothbrush_str,toothbrush_time,ruler_str,ruler_time,boat_str,boat_time,elephant_str,elephant_time,crab_str,crab_time,bug_str,bug_time,monkey_str,monkey_time,rope_str,rope_time,heart_str,heart_time,fish_str,fish_time,plug_str,plug_time,jacket_str,jacket_time,helicopter_str,helicopter_time,rhinoceros_str,rhinoceros_time,corkscrew_str,corkscrew_time,envelope_str,envelope_time,wagon_str,wagon_time,belt_str,belt_time,antlers_str,antlers_time,stocking_str,stocking_time,saltshaker_str,saltshaker_time,car_str,car_time,refrigerator_str,refrigerator_time,airplane_str,airplane_time,pig_str,pig_time,cherry_str,cherry_time,circle_str,circle_time,stool_str,stool_time,gun_str,gun_time,balloon_str,balloon_time,crib_str,crib_time,vest_str,vest_time,snail_str,snail_time,hippo_str,hippo_time,tennisracket_str,tennisracket_time,fence_str,fence_time,gorilla_str,gorilla_time,bear_str,bear_time,chest_str,chest_time,brush_str,brush_time,ostrich_str,ostrich_time,priest_str,priest_time,mountain_str,mountain_time,x_str,x_time,chisel_str,chisel_time,bed_str,bed_time,eye_str,eye_time,basket_str,basket_time,asparagus_str,asparagus_time,scissors_str,scissors_time,couch_str,couch_time,flashlight_str,flashlight_time,box_str,box_time,grave_str,grave_time,watermelon_str,watermelon_time,knife_str,knife_time,leg_str,leg_time,blouse_str,blouse_time,violin_str,violin_time,rock_str,rock_time,tomato_str,tomato_time,parachute_str,parachute_time,dustpan_str,dustpan_time,vase_str,vase_time,sewingmachine_str,sewingmachine_time,house_str,house_time,backpack_str,backpack_time,door_str,door_time,diaper_str,diaper_time,curtains_str,curtains_time,nail_str,nail_time,bowl_str,bowl_time,dresser_str,dresser_time,butterfly_str,butterfly_time,ladle_str,ladle_time,toaster_str,toaster_time,leaf_str,leaf_time,cannon_str,cannon_time,square_str,square_time,whistle_str,whistle_time,triangle_str,triangle_time,glasses_str,glasses_time,skateboard_str,skateboard_time,skunk_str,skunk_time,clown_str,clown_time,dime_str,dime_time,grapes_str,grapes_time,ironingboard_str,ironingboard_time,closet_str,closet_time,safetypin_str,safetypin_time,hair_str,hair_time,shirt_str,shirt_time,rollingpin_str,rollingpin_time,bell_str,bell_time,gas_str,gas_time,hook_str,hook_time,glass_str,glass_time,bucket_str,bucket_time,worm_str,worm_time,top_str,top_time,garbage_can_str,garbage_can_time,barrel_str,barrel_time,strawberry_str,strawberry_time,well_str,well_time,ax_str,ax_time,seal_str,seal_time,necklace_str,necklace_time,cake_str,cake_time,ring_str,ring_time,genie_str,genie_time,beard_str,beard_time,pitcher_str,pitcher_time,pear_str,pear_time,tape_str,tape_time,pliers_str,pliers_time,giraffe_str,giraffe_time,train_str,train_time,owl_str,owl_time,celery_str,celery_time,wheel_str,wheel_time,bricks_str,bricks_time,skirt_str,skirt_time,truck_str,truck_time,clock_str,clock_time,bicycle_str,bicycle_time,egg_str,egg_time,kettle_str,kettle_time,shoe_str,shoe_time,lettuce_str,lettuce_time,lawnmower_str,lawnmower_time,tent_str,tent_time,tie_str,tie_time,table_str,table_time,lemon_str,lemon_time,wheelchair_str,wheelchair_time,scale_str,scale_time,peacock_str,peacock_time,frying_pan_str,frying_pan_time,spiderweb_str,spiderweb_time,broom_str,broom_time,tear_str,tear_time,screwdriver_str,screwdriver_time,sled_str,sled_time,arm_str,arm_time,peach_str,peach_time,lock_str,lock_time,bread_str,bread_time,thumb_str,thumb_time,chicken_str,chicken_time,teapot_str,teapot_time,fishingpole_str,fishingpole_time,football_str,football_time,deer_str,deer_time,turtle_str,turtle_time,pumpkin_str,pumpkin_time,peas_str,peas_time,zebra_str,zebra_time,paintbrush_str,paintbrush_time,chain_str,chain_time,eskimo_str,eskimo_time,rollerskate_str,rollerskate_time,peanut_str,peanut_time,vacuum_str,vacuum_time,football_helmet_str,football_helmet_time,cactus_str,cactus_time,doorknob_str,doorknob_time,tv_str,tv_time,sailboat_str,sailboat_time,piano_str,piano_time,suitcase_str,suitcase_time,mosquito_str,mosquito_time,lipstick_str,lipstick_time,nut_str,nut_time,purse_str,purse_time,sandwich_str,sandwich_time,mitten_str,mitten_time,kangaroo_str,kangaroo_time,crown_str,crown_time,flag_str,flag_time,button_str,button_time,cigarette_str,cigarette_time,baseball_bat_str,baseball_bat_time,ghost_str,ghost_time,turkey_str,turkey_time,hammer_str,hammer_time,saddle_str,saddle_time,bird_str,bird_time,fork_str,fork_time,hand_str,hand_time,mixer_str,mixer_time,recordplayer_str,recordplayer_time,swan_str,swan_time,rockingchair_str,rockingchair_time,mask_str,mask_time,guitar_str,guitar_time,fly_str,fly_time,duck_str,duck_time,floor_str,floor_time,bottle_str,bottle_time,hat_str,hat_time,fox_str,fox_time,camel_str,camel_time,net_str,net_time,typewriter_str,typewriter_time,mushroom_str,mushroom_time,igloo_str,igloo_time,panda_str,panda_time,paint_str,paint_time,fishtank_str,fishtank_time,ladder_str,ladder_time,cigar_str,cigar_time,artichoke_str,artichoke_time,hanger_str,hanger_time,flute_str,flute_time,telephone_str,telephone_time,policeman_str,policeman_time,key_str,key_time,carrot_str,carrot_time,pot_str,pot_time,potato_str,potato_time,zipper_str,zipper_time,pants_str,pants_time,bone_str,bone_time,fire_str,fire_time,ear_str,ear_time,toilet_str,toilet_time,doll_str,doll_time,pineapple_str,pineapple_time,lion_str,lion_time,binoculars_str,binoculars_time,hamburger_str,hamburger_time,walnut_str,walnut_time,camera_str,camera_time,chair_str,chair_time,ashtray_str,ashtray_time,bee_str,bee_time,umbrella_str,umbrella_time,globe_str,globe_time,harp_str,harp_time,motorcycle_str,motorcycle_time,lobster_str,lobster_time,sock_str,sock_time,slide_str,slide_time,alligator_str,alligator_time,rabbit_str,rabbit_time,block_str,block_time,arrow_str,arrow_time,banana_str,banana_time,crackers_str,crackers_time,sheep_str,sheep_time,thread_str,thread_time,puzzle_str,puzzle_time,sweater_str,sweater_time,radish_str,radish_time,porcupine_str,porcupine_time,foot_str,foot_time,bus_str,bus_time,lamp_str,lamp_time,kite_str,kite_time,desk_str,desk_time,trumpet_str,trumpet_time,rake_str,rake_time,canopener_str,canopener_time,wheat_str,wheat_time,railroadtracks_str,railroadtracks_time,lightbulb_str,lightbulb_time,finger_str,finger_time,tree_str,tree_time,trash_str,trash_time,goat_str,goat_time,star_str,star_time,glove_str,glove_time,swing_str,swing_time,moon_str,moon_time,mouse_str,mouse_time,waffle_str,waffle_time,screw_str,screw_time,eagle_str,eagle_time,dog_str,dog_time,corn_str,corn_time,toe_str,toe_time,coat_str,coat_time,stoplight_str,stoplight_time,road_str,road_time,frog_str,frog_time,earring_str,earring_time,rooster_str,rooster_time,music_str,music_time,book_str,book_time,candle_str,candle_time,drum_str,drum_time) 
VALUES ("0","on","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","2228","","518","","37","","36","","37","","39","","35","","37","","37","","36","","44","","30","","37","","37","","37","","41","","32","","37","","47","","27","","37","","37","","36","","37","","37","","37","","37","","37","","36","","41","","33","","37","","37","","37","","37","","36","","37","","38","","36","","38","","36","","36","","37","","37","","37","","37","","37","","37","","37","","37","","37","","37","","39","","35","","37","","37","","36","","37","","37","","37","","37","","37","","36","","38","","36","","39","","35","","37","","37","","36","","37","","37","","37","","37","","37","","37","","36","","37","","37","","37","","37","","37","","37","","36","","37","","37","","37","","37","","37","","36","","37","","37","","37","","37","","37","","37","","36","","37","","37","","37","","37","","37","","37","","36","","37","","39","","35","","37","","37","","37","","36","","37","","37","","37","","37","","37","","36","","37","","37","","37","","37","","39","","35","","37","","37","","37","","37","","37","","36","","37","","37","","37","","37","","37","","37","","37","","37","","36","","37","","37","","46","","27","","37","","39","","35","","37","","36","","38","","37","","37","","37","","37","","36","","37","","37","","37","","39","","35","","36","","38","","36","","36","","37","","39","","37","","35","","37","","37","","37","","37","","36","","37","","37","","37","","38","","36","","37","","36","","38","","36","","37","","37","","36","","37","","37","","37","","37","","36","","37","","37","","37","","38","","36","","37","","39","","34","","37","","37","","37","","36","","52","","22","","37","","37","","37","","37","","36","","37","","38","","36","","37","","37","","36","","37","","37","","37","","37","","37","","36","","37","","37","","39","","35","","37","","37","","37","","39","","35","","37","","37","","37","","36","","37","","37","","37","","37","","36","","37","","37","","36","","37","","37","","37","","37","","36","","37","","37","","37","","39","","44","","28","","36","","37","","37","","37","","37","","37","","37","","36","","37","","37","","37","","37","","37","","37","","38","","36","","36","","41","","33","","39","","36","","37","","37","","36","","36","","36","","37","","38","","36","","37","","37","","36","","40","","35","","37","","36","","37","","37","","36","","37","","37","","40","","35","","36","","43","","30","","39","","36","","36","","37","","36","","37","","49","","25","","37","","39","","36","","36","","40","","34","","37","","36","","37","","37","","37","","37","","36","","39","","35","","37","","37","","37","","36","","37","","37","","36","","41","","35","","36","","37","","37","","36","","39","","36","","36","","37","","37","","36","","37","","37","","37","","37","","37","","45","","28","","37","","36","","37","","39")

提前致谢!

2 个答案:

答案 0 :(得分:1)

从错误消息判断,您的直接问题是由于您在INSERT语句周围有额外的双引号或至少在INSERT前面的乞讨权利

引起的
"INSERT INTO survey (lang,check,lname,fname,age,dob,dlang1,dlang2,dlang3,dlang4,
^^

除了check是MySQL中的保留字之外,所以把它放在反引号'''中。

另外,您最好将值放在单引号而不是双引号中。

据说你的INSERT语句看起来应该像

INSERT INTO survey (lang,`check`,lname,...) VALUES ('0','on','',...)
^                        ^     ^                    ^ ^ ^  ^ ^^

答案 1 :(得分:0)

请引用所有列名称。见下面的exp

INSERT INTO survey (`lang`,`check`,`lname`,`fname`,`age`,`dob`...