Import a table into an existing table using phpMyAdmin

When I do this, it makes a new table, but I have already selected the table to import. I tried the CSV and ODS format, still getting the same results. The first column in my existing table is the auto incremented identifier. I tried to put an empty column (in the file that I am importing) to compensate, and I also tried it without putting an extra column. Did I miss something simple here?

+6
source share
5 answers

You can import one table into another table in Phpmyadmin.

  • Normalize two tables so that the structure matches
  • Rename the table you want to export so that it matches the imported table.
  • Go ahead export / import into regular SQL, merge automatically

I just went through the steps myself successfully, imported several columns individually selected from the table in Phpmyadmin 3.3.2, and tried to import them into the table in Phpmyadmin 3.5.1, at first all that happened was that the old table was replicated to the new DB, but this was decided as soon as I renamed it to match the name of the new table (and normalized the structure).

+3
source

First of all, I am new to this, but just fooling myself, trying to figure out how to achieve something like this, and get it to work, it's hard to believe the answers here.

We are talking about phpMyAdmin here, which has endless options. You CAN choose to export the origin table with the parameters - renaming the database and the table in progress - telling someone to rename the existing database or table is irresponsible at best. No need for this.

Besides, no one seems to mention that we really want to import COLUMNS into an existing table - the table is the same in all respects, with the possible exception of the table and the database name, right?

Here's what I did: I did a simple export of the origin table, which is identical, with the exception of the name, as the target table. I opened the sql file in SQL Management Studio (without MS, and you can also use something like TextPad to do the same), and deleted all the things at the beginning about creating a database, tables, etc. (Put it where it says "INSERT" - leave it). Then I replaced any instance of the orgin table name with the name of the existing target table. Then you will see all the data columns in this sql file. Delete everything after the last column that you want to import. Nothing more is needed. Save this file with the name of the target table. Import this sql file - nothing is needed. Done.

COMMENT. If you already have existing columns in the target table, you will be mistaken in the first column because you have a primary key that matches the target that it is trying to use in the source columns. Honestly, I do not know how to fix this. I had 7 columns already (primary keys 1-7) in the target table, so I just cut these columns out while editing the sql file inserted at the end of the column list and changed the keys to be sequential from the last. You must also change the previous end of the last line; to, and then a new last line from, to; I hope if you need to do this, then someone with more experience can suggest a better way to do this - for example, ignore imported keys and automatically increase them when importing. Or the best way to export so that this part automatically takes care of the import. As I mentioned earlier, there are TON export options, including the ability to correct database names and tables during export. I am sure there is something about auto-incrementing the primary key.

By the way, when you say "select a table", do you intend to click on it in the list of tables on the left, and then click the import button on the right? I thought it meant something, if that was what you had in mind. This means nothing. The import button imports the sql script - this is it. What happens, where it happens, etc., depends entirely on the script itself.

Hope this helps someone.

+3
source

You cannot import one table into another table in phpmyadmin.
If you try to do this, it will create new tables in your database.
For more help, you can refer to this: IMPORTED DATABASES AND TABLES WITH PHPMYADMIN

+1
source

You can import into an existing table from an excel file as long as you name your worksheet the same as the name of your table.

So, if I tried to import into the table "owner", I would name my worksheet in the "owners" of Excel.

+1
source

if you are loading imports from another phpMyAdmin database. When loading a table from user-specific format-specific options, you can select only data (without structure). Then it will be imported without problems.

For other imports, you will have to modify the data manually so as not to have structural properties.

0
source

All Articles