mysql:exportcsv
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| mysql:exportcsv [2011/10/24 09:14] – rlunaro | mysql:exportcsv [2022/12/02 21:02] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Make a select and export to csv ====== | ||
| + | |||
| + | I've tried this to make a csv file, to import directly into Microsoft Excel. You can try also with character set ' | ||
| + | |||
| + | <code sql> | ||
| + | select blah, blah | ||
| + | from table | ||
| + | into outfile ' | ||
| + | character set ' | ||
| + | columns terminated by ';' | ||
| + | enclosed by '"'; | ||
| + | | ||
| + | </ | ||
| + | |||
| + | ====== Import from CSV ====== | ||
| + | |||
| + | |||
| + | <code sql> | ||
| + | LOAD XML [LOW_PRIORITY | CONCURRENT] | ||
| + | LOCAL INFILE ' | ||
| + | [REPLACE | IGNORE] | ||
| + | INTO TABLE [db_name.]tbl_name | ||
| + | [CHARACTER SET charset_name] | ||
| + | [ROWS IDENTIFIED BY '< | ||
| + | [IGNORE number [LINES | ROWS]] | ||
| + | [(column_or_user_var, | ||
| + | [SET col_name = expr,...] | ||
| + | |||
| + | </ | ||
| + | |||
| + | http:// | ||
| + | |||
| + | |||
| + | |||
