Skip to content

Instantly share code, notes, and snippets.

@alyjee
Last active June 26, 2018 13:27
Show Gist options
  • Save alyjee/257435785e9d6fca3ecfa53295c4402b to your computer and use it in GitHub Desktop.
Save alyjee/257435785e9d6fca3ecfa53295c4402b to your computer and use it in GitHub Desktop.
Some usual/unusual queries for mySql
-- Load Data from a text file with comma separated columns
LOAD DATA LOCAL INFILE '/path/to/file.txt' INTO TABLE `tableName`
FIELDS TERMINATED BY 'x'
-- (here x could be comma ',', tab '\t', semicolon ';', space ' ')
LINES TERMINATED BY 'y';
-- (here y is a new line character, it can be ¬, \n or anything) sometimes you may need to use only fields teminated by
----------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment