In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces how to copy the table in MySQL. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.
Copy table structure and its data
Note: this statement actually creates a table of the results of the select statement, so the new table will not have a primary key or index.
Create table table_name_new as (select * from table_name_old)
Copy only the table structure
Create table table_name_new as select * from table_name_old where 1: 2
Or
Create table table_name_new like table_name_old
Note: the former method does not copy the primary key type, index, while the latter is to copy all the field types of the old table to the new table.
Copy only table data
If the two tables have the same structure
Insert into table_name_new select * from table_name_old
If the structure of two tables is not the same
Insert into table_name_new (column1,column2...) Select column1,column2... From table_name_old
Note: many articles say that data can be copied with the following statement, the table_name_ new table may not exist and will be created automatically during execution. Actually, we should SELECT... The form of INTO is to store the query results in a variable or write it to a file, that is, table_name_new is a variable or file.
Select column1,column2,.... Into table_name_new from table_name_old; on how to copy tables in MySQL to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.