Mysql Load Inline-特定列 [英] Mysql Load Inline - Specific Columns

查看:151
本文介绍了Mysql Load Inline-特定列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从此处提出的问题中寻找更多解释:

Looking for a bit more explanation from question asked here:

用户问题

我看过MySQL上的文档,但是我正在寻找更简单的术语,因为网站上的内容没有意义.我不明白是什么:

I've looked over the doc on MySQL however I'm looking for bit simpler terms as things aren't making sense on the site. I don't understand what:

LOAD DATA INFILE 'file.csv'
INTO TABLE t1
(column1, @dummy, column2, @dummy, column3, ...)
FIELDS TERMINATED BY ',' ENCLOSED BY '"' ESCAPED BY '"'
LINES TERMINATED BY '\r\n';`

@dummy是干什么的?

the @dummy's are for?

如果我有a,b,c列和那些数据,我将如何插入而仅限制那些?

If i have columns a,b,c and data for those how would I insert it limiting only those?

谢谢

推荐答案

以防CSV中的数据包含5列,但您只想使用其中3列的情况-您可以使用@dummy来指定该列实际上不会写入表中.

It's in case the data in your CSV contains say 5 columns but you only want to use 3 of them for instance -- you use @dummy to specify that the column won't be in fact written into the table.

这篇关于Mysql Load Inline-特定列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆