简体   繁体   English

将 phpmyadmin 上的数据导入多个表

[英]importing data on phpmyadmin to multiple tables

I have a database on phpmyadmin and I would like to import some data from a csv file.我在 phpmyadmin 上有一个数据库,我想从 csv 文件中导入一些数据。

  • My database is structured in the following way: there are N tables, each one of them has the same number of columns (M).我的数据库的结构如下:有 N 个表,每个表都有相同的列数 (M)。
  • In my csv file I have N rows, each row with M values.在我的 csv 文件中,我有 N 行,每行有 M 个值。 When importing the file导入文件时
  • I would like to add the first row to the first table, second row to the second table and so on.我想将第一行添加到第一个表中,将第二行添加到第二个表中,依此类推。

How can I do it?我该怎么做? I've looked online but only found how to import data to one table, not to multiple tables at the same time.我在网上查看过,但只找到了如何将数据导入一个表,而不是同时导入多个表。 Thanks for your help谢谢你的帮助

There's currently no way for phpMyAdmin to handle that type of complex import.目前 phpMyAdmin 无法处理这种类型的复杂导入。

There are a number of ways you could use text-processing tools to manipulate the data in to a more usable form for import, but at that point you might as well add 20 more lines of code and handle the import directly.有多种方法可以使用文本处理工具将数据处理为更有用的导入形式,但此时您最好再添加 20 行代码并直接处理导入。 Using phpMyAdmin for this type of import is going to be inefficient, but what you may benefit from is splitting the file in to individual files (per-table) and using the phpMyAdmin drag-and-drop import feature to change to a table and drop the file for a quick import.使用 phpMyAdmin 进行这种类型的导入将效率低下,但您可能会从中受益的是将文件拆分为单个文件(每个表)并使用 phpMyAdmin 拖放导入功能更改为一个表并拖放用于快速导入的文件。 It's somewhat fewer clicks than going to the Import tab, navigating to the file, and then selecting to import.与转到“导入”选项卡、导航到文件然后选择导入相比,点击次数要少一些。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM