Last active
December 17, 2015 06:39
-
-
Save fedir/5567014 to your computer and use it in GitHub Desktop.
An example of advanced import into MySQL database using LOAD DATA INFILE #mysql #csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* An example of advanced import into MySQL database using LOAD DATA INFILE | |
* | |
* import of first and second column from the file directly | |
* third column is equal to current datetime | |
* fourth column is transformed value of third column of csv file | |
* ref. : http://dev.mysql.com/doc/refman/5.1/en/load-data.html | |
*/ | |
LOAD DATA INFILE 'file.txt' | |
INTO TABLE t1 | |
(column1, column2, @var1) | |
SET column3 = CURRENT_TIMESTAMP, column4 = @var1/100; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment