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声明:本网页内容旨在传播知识,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。TEL:177 7030 7066 E-MAIL:11247931@qq.com