Diety Dieticheskie-produkty Protsedury Sredstva Uprajneniya Fitnes Gimnastika Yoga Pitanie Tsellyulit Zdorove Krasota

You might have a table with some information and you want to copy the data of a few columns to another table. First thing you need to do is to create a table with columns same to the specific columns you require from original table.

Let say you have a table table1 with following fields:

name, email, company

You want to copy all the names and emails to a new table. So you will create a new table let say table2 with fields:

name, email

Following query will copy all the names and emails from table1 to table2

INSERT INTO`table2`(name, email)
SELECT name, email
FROM `table1`

You can also copy filtered records using where clause like

INSERT INTO `table2`(name, email )
SELECT name, email
FROM` table1`
WHERE company='Google'
Tagged with:
 

Leave a Reply

Your email address will not be published. Required fields are marked *