Heim >Datenbank >MySQL-Tutorial >Mysql数据导入_MySQL

Mysql数据导入_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-01 13:49:131068Durchsuche

bitsCN.com

1、数据文件格式(位于C:/test.bat):

Name, Age, IncomeRange, Education, Skills, Social, isPaidAlbert, 23, 0, 0, 3, 3, 0Alexandra, 25, 1, 2, 4, 2, 0Athena, 24, 0, 1, 3, 4, 0Aurora, 23, 1, 2, 5, 2, 0Babis, 21, 0, 0, 3, 4, 0Bill, 31, 1, 2, 4, 2, 0Bob, 32, 1, 1, 3, 1, 1Carl, 30, 0, 2, 4, 2, 0Catherine, 31, 1, 1, 3, 3, 0Charlie, 30, 1, 2, 3, 2, 0Constantine, 37, 1, 1, 3, 2, 0Dmitry, 35, 2, 2, 1, 1, 1Elena, 38, 1, 1, 3, 2, 0Eric, 37, 2, 2, 2, 2, 0Frank, 39, 3, 1, 3, 1, 1George, 42, 2, 2, 2, 1, 1Jack, 43, 3, 1, 1, 1, 1John, 45, 4, 2, 1, 1, 1Maria, 43, 2, 1, 3, 1, 0Lukas, 45, 3, 2, 1, 1, 1

2、执行导入语言:

CREATE DATABASE iweb2;USE iweb2;CREATE TABLE sf_users (Name VARCHAR(250) NOT NULL PRIMARY KEY, Age INT NOT NULL, IncomeRange INT NOT NULL,            Education INT NOT NULL, Skills INT NOT NULL, Social INT NOT NULL, isPaid INT NOT NULL);                       LOAD DATA INFILE 'C://test.dat' INTO TABLE sf_users FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '/n' IGNORE 1 LINES;

3、导入结果:

bitsCN.com
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn