0

以下 mysql 命令不会将任何内容导入数据库,

LOAD DATA INFILE "Database1.csv" REPLACE  INTO TABLE business FIELDS TERMINATED BY ',' ESCAPED BY '"' LINES TERMINATED BY '\n' IGNORE 1 LINES  (business_name,address,city,state,zip_code,website,phone,contact_name) SET website = nullif(website,''), contact_name = nullif(contact_name,'')

以下是业务表的结构:

CREATE TABLE `business` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `metro_id` bigint(20) DEFAULT NULL,
  `contact_name` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
  `contact_email` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
  `business_name` varchar(512) COLLATE utf8_unicode_ci DEFAULT NULL,
  `city` varchar(512) COLLATE utf8_unicode_ci DEFAULT NULL,
  `state` varchar(512) COLLATE utf8_unicode_ci DEFAULT NULL,
  `zip_code` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
  `phone` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `website` varchar(512) COLLATE utf8_unicode_ci DEFAULT NULL,
  `address` varchar(512) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

以下是样本数据

Nail Glamour,7407 Legend Point Dr,San Antonio,TX,78244-2411,,2106665200,Bich-Ha Nguyen
G & S Fire Systems,P.O. BOX 182192,Arlington,TX,76096-2192,,9726479274,Gary Jones
Harold R Moore Dr,764 W Commerce St,Fairfield,TX,75840-1428,,9033894151,Harold Moore
Cerda Roofing,563 N 1st St,Beaumont,TX,77701-1646,,4098357569,
Jason Doerr & Freinds Mem,1201 Wildwood Trl,Lancaster,TX,75146-3530,,9722271769,Jason Doerr
R & D Finishing,P.O. BOX 171,Newark,TX,76071-0171,,8176389128,Raffaele Reitnauer
Wtamu Alumni Assoc,P.O. BOX 60753,Canyon,TX,79016-0001,,8066512311,M Brown
Papa Dantes Italian Restaurant,P.O. BOX 669,Converse,TX,78109-0669,,2106585261,Rosemarie Dante
George P Kirkpatrick Jr,1100 S Pecan St,Kountze,TX,77625-7449,,4092463912,George P Kirkpatrick Jr
Flowers By Alicia,12502 River Trail Dr,Houston,TX,77050-2808,,2819873239,Alicia Thomas
Pepi Alonti Deli,777 Walker St,Houston,TX,77002-5316,,7132249988,Russ Watkins
Anderson Automotive Performanc,305 Tyler,Longview,TX,75601,,9037583881,
Checkrite of Austin,P.O. BOX 42377,Austin,TX,78704-0040,,5124400994,William Archer
Kohler Rental Power,11175 Windfern Rd,Houston,TX,77064-4807,,2814779108,Erik Hansen
Red Iron Fabrication,5029 Ridgeview CT,Fort Worth,TX,76180-7812,,8174286406,David Jones
4

0 回答 0