mysql 导出数据为csv格式
生活随笔
收集整理的這篇文章主要介紹了
mysql 导出数据为csv格式
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name.txt'[REPLACE | IGNORE]INTO TABLE tbl_name[FIELDS[TERMINATED BY '\t'] -- 在字段之間寫入制表符[[OPTIONALLY] ENCLOSED BY ''] --不把字段包含在任何引號字符中。如果是ENCLOSED BY "'" :使用單引號把各個字段括起來;[ESCAPED BY '\\' ] --當(dāng)字段值中出現(xiàn)制表符、新行或‘\’時,使用‘\’進(jìn)行轉(zhuǎn)義。][LINES[STARTING BY '\n'] -- 在行的末端寫入新行。[TERMINATED BY ''] --不會跳過任何行前綴。][IGNORE number LINES][(col_name_or_user_var,...)][SET col_name = expr,...)]SELECT * INTO outfile 'e:/tmp/t_aty_corp.sql' FIELDS TERMINATED BY '$' OPTIONALLY ENCLOSED BY "'" ESCAPED BY '\\' LINES STARTING BY '\r\n' TERMINATED BY '' FROM db_aty.t_aty_corp;'1100'$'監(jiān)獄管理局'$\N$1$\N$'監(jiān)獄管理局'$1$1$'1100'$'1'$\N$'2011-01-12 00:00:00'$
'1101'$'第一監(jiān)獄'$'1100'$2$\N$'第一監(jiān)獄'$1$2$'1101'$'1'$\N$'2011-01-12 00:00:00'$
'1102'$'第二監(jiān)獄'$'1100'$2$\N$'第二監(jiān)獄'$1$3$'1102'$'1'$\N$'2011-01-12 00:00:00'$SELECT * INTO outfile 'e:/tmp/t_aty_corp.sql' FIELDS TERMINATED BY '$' OPTIONALLY ENCLOSED BY "^" ESCAPED BY '\\' LINES STARTING BY '\r\n' TERMINATED BY '' FROM db_aty.t_aty_corp;^1100^$^監(jiān)獄管理局^$\N$1$\N$^監(jiān)獄管理局^$1$1$^1100^$^1^$\N$^2011-01-12 00:00:00^$
^1101^$^第一監(jiān)獄^$^1100^$2$\N$^第一監(jiān)獄^$1$2$^1101^$^1^$\N$^2011-01-12 00:00:00^$
^1102^$^第二監(jiān)獄^$^1100^$2$\N$^第二監(jiān)獄^$1$3$^1102^$^1^$\N$^2011-01-12 00:00:00^$
總結(jié)
以上是生活随笔為你收集整理的mysql 导出数据为csv格式的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 嘴巴上有了婆婆纹怎么办
- 下一篇: windows 下anaconda创建环