Consider the following schema:
CREATE TABLE loadtest (
pkey int(11) NOT NULL auto_increment,
name varchar(20),
exam int,
score int,
time_enter timestamp(14),
PRIMARY KEY (pkey),
);
And the data you need to load:
'name22999990',2,94 'name22999991',3,93 'name22999992',0,91
Running this query would load the data into the columns name, exam, score:
mysql> LOAD DATA INFILE '/tmp/out.txt' INTO TABLE loadtest
-> FIELDS TERMINATED BY ',' (name,exam,score);
** Note: This tip borrowed from the Linux Gazette. You can read the complete article at http://www.linuxgazette.com/node/9059.
dataloadmysqlqueriesschemasql