加载文件到mysql [英] Load file into mysql

查看:53
本文介绍了加载文件到mysql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将制表符分隔的文件加载到 mysql 数据库中.我的数据库设置了列:ID;A;B;C;D;E,我的文件是列 ID 和 D 的转储.如何将此文件加载到我的数据库中并仅替换列 ID 和 D更改列 C 和 E 的值.当我现在加载它时,列 C 和 E 更改为 DEFAULT:NULL.

I need to load a tab delimited file into mysql database. My database is set up with columns: ID;A;B;C;D;E and my file is a dump of columns ID and D. How can I load this file into my db and replace just columns ID and D, which out changing the values of columns C and E. When I load it in now, columns C and E are changed to DEFAULT:NULL.

推荐答案

我已经回答过类似这样的问题 此处,但在您的情况下,您希望将 csv 加载到临时表中,然后使用简单的更新 SQL 语句从您的临时表到您的生产表.

I already answered a similar question like this here, but in your case, you'd want to load the csv into a temporary table, then use a simple update SQL statement to update the specific columbs from your temporary table to your production table.

这篇关于加载文件到mysql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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