Grabbing more info about MySQL

What is the query to copy one item of the table to another table in MySQL?

Hi Sarthak_Bhati,

I am bit confused about the term “one item of the table to another table”. In general, you can use INSERT with the combination of SELECT.

for example, if you want to copy all the records from a–>b , “insert into b select * from a;” ( you can use the WHERE clause if some particular records needed ). But, make sure the “select *” will works if both the tables have same amount of columns and the Data types matter here.

you can also use “select column1, column2 insert into” to copy some particular columns data. Again, if the data type is not compatible, you might face some error.

So, these are the general ways. If this is not helps, please elaborate your requirement, we will get back on that.

Sri Sakthivel M.D.

1 Like