How To Transfer Data From One Table To Another

Table of contents:

How To Transfer Data From One Table To Another
How To Transfer Data From One Table To Another

Video: How To Transfer Data From One Table To Another

Video: How To Transfer Data From One Table To Another
Video: SQL Tutorial - 13: Inserting Data Into a Table From Another Table 2024, May
Anonim

To transfer data from one MySQL DBMS table to another, the same table, it is convenient to use the PhpMyAdmin application, which is distributed free of charge, has a simple interface and allows you to perform the necessary operations even without knowing the SQL language. All manipulations are performed in the browser window. Almost all hosting providers offer this application to their customers.

How to transfer data from one table to another
How to transfer data from one table to another

Instructions

Step 1

Use the export data function if the table into which you want to place the data is not on the same server as the original table. To do this, click the link to the source table in the left frame, and in the page loaded into the right frame, click the "Export" link in the menu. In the form that the application will then show, find the "Structure" section and uncheck the checkbox placed next to this label. In this way, you will cancel the export of data about the structure of the table - you do not need it, since it is assumed that a table on another server with the same structure and name already exists. If this table still needs to be created, then leave a check in this field. The rest of the settings can be left unchanged and click "OK". PhpMyAdmin will output a set of exported SQL queries in a multi-line text box on the next page.

Step 2

Log in to the PhpMyAdmin application placed on the server containing the target table - this must be done in another tab (or another window) of the browser, leaving the page with the exported data SQL statements open. Navigate to the database you want and click the SQL tab in the right frame menu. Then switch to the open page with the data of the source table, copy them, go back, paste the copied statements into the SQL query input field and click the "OK" button. The application will send requests to the server and the data will be added to the table.

Step 3

If you need to add information from the source table to any table on the same server, then by clicking on the link to the source table in the left frame, click the "Operations" tab in the menu of the right frame. Find the section titled "Copy table to" and select the name of the database in which the target table is located in the drop-down list. To the right of the drop-down list is a field where you need to specify the name of the table. If this table already exists and data needs to be added to the rows already contained in it, then check the box "Data only". If the table still needs to be created or in the existing table it is necessary to replace all the rows with the copied data, then check the boxes "Structure and data" and DROP TABLE. Then click the "OK" button and the application will perform the operation.

Recommended: