导入语法如下:
[plain] view plain copy print
LOAD DATA INFILE '[FILE]'
INTO TABLE [TABLE];
或者
LOAD DATA INFILE '[FILE]'
INTO TABLE [TABLE]
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n';
下边是一个具体的导入的例子:
[plain] view plain copy print
LOAD DATA INFILE '/tmp/mytablecsv'
INTO TABLE mytable
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n';
导出语法如下:
[plain] view plain copy print
SELECT FROM [TABLE]
INTO OUTFILE '[FILE]';
或者
SELECT FROM [TABLE]
INTO OUTFILE '[FILE]'
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n';
下边是一个具体的导出的例子:
[plain] view plain copy print
SELECT FROM mytable
INTO OUTFILE '/tmp/mytablecsv'
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n';
1、首先打开sqlserver选择一个数据库,右击选择任务,点击导入数据打开导入导出向导:
2、进入向导,下一步来到数据源的选择界面:
3、接着点击数据源下拉框,选择平面文件源:
4、在d出的窗口中,选择csv文件,筛选一下数据,点击下一步:
5、随后一路下一步,一直到出现完成按钮就说明导入成功了:
以上就是关于如何将csv导入mysql和mysql导出csv全部的内容,包括:如何将csv导入mysql和mysql导出csv、如何把csv文件批量导入到mysql数据库、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)