当前位置:网站首页>MySql copies data from one table to another table
MySql copies data from one table to another table
2022-08-02 06:09:00 【web15286201346】
1. Copy the data of the old table to the new table (assuming the two tables have the same structure) INSERT INTO new table SELECT * FROM old table
INSERT INTO tbl_user_copy SELECT * FROM tbl_user;
Data volume: 5 million, time: 138.678s (2.3 minutes);
Time to delete 5 million data: 142.89s (2.38 minutes)
2. Copy the table structure and data to the new table CREATE TABLE target table name SELECT * FROM source table name
select * into target table name from source table name (requires that the target table does not exist, because it will be automatically created when inserting) (Note: this statement is not suitable for mysql)
Statement: CREATE TABLE tbl_user_copy SELECT * FROM tbl_user
Data volume: 5 million, time: 113.266s;
3. Only copy the table structure:
CREATE TABLE new table
SELECT * FROM old table WHERE 1=2
3. Table backup with different table structure
INSERT INTO new table (field1, field2,....)
SELECT field1, field2,... FROM old table
Let me introduce myself first. The editor graduated from Shanghai Jiaotong University in 2013. I worked in a small company and went to big factories such as Huawei and OPPO. I joined Alibaba in 2018, until now.I know that most junior and intermediate java engineers want to upgrade their skills, they often need to explore their own growth or sign up to study, but for training institutions, the tuition fee is nearly 10,000 yuan, which is really stressful.Self-learning that is not systematic is very inefficient and lengthy, and it is easy to hit the ceiling and the technology stops.Therefore, I collected a "full set of learning materials for java development" for everyone. The original intention is also very simple. I hope to help friends who want to learn by themselves but don't know where to start, and at the same time reduce everyone's burden.Add the business card below to get a full set of learning materials
边栏推荐
- UE4 利用Mixamo自动绑骨并导入虚幻4
- Mysql实现乐观锁
- MySQL夺命10问,你能坚持到第几问?
- ApiPost is really fragrant and powerful, it's time to throw away Postman and Swagger
- The practice of alibaba, data synchronization component canal
- mysql 查询表 所有字段
- UE4 创建开始游戏界面UI
- CAN光端机解决泰和安TX3016C消防主机长距离联网问题 实现CAN与光纤之间的双向数据智能转换
- MySQL multi-table association one-to-many query to get the latest data
- JDBC revisited
猜你喜欢
CAN光端机解决泰和安TX3016C消防主机长距离联网问题 实现CAN与光纤之间的双向数据智能转换
Detailed explanation of AMQP protocol
选择黑盒测试用例设计方法的综合策略方案总结
[Digital IC hand-tear code] Verilog fixed priority arbiter | topic | principle | design | simulation
Android studio connects to MySQL and completes simple login and registration functions
简道云-灵活易用的应用搭建平台
从DES走到AES(现代密码的传奇之路)
Navicat new database
JDBC revisited
MySQL 灵魂 16 问,你能撑到第几问?
随机推荐
行测不会概念
【MLT】MLT多媒体框架生产消费架构解析(一)
Android studio连接MySQL并完成简单的登录注册功能
The original question on the two sides of the automatic test of the byte beating (arranged according to the recording) is real and effective 26
11种你需要了解的物联网(IoT)协议
el-input 只能输入整数(包括正数、负数、0)或者只能输入整数(包括正数、负数、0)和小数
pg数据库报错问题,有懂的吗
MySQL 字符串拼接 - 多种字符串拼接实战案例
MySQL如何创建用户
The practice of alibaba, data synchronization component canal
简道云-灵活易用的应用搭建平台
MySQL 8.0.29 decompressed version installation tutorial (valid for personal testing)
来自雪域高原的馈赠——大凉山高原生态糖心苹果
H5如何实现唤起APP
牛客-TOP101-BM41
力扣 2127. 参加会议的最多员工数 拓扑剪枝与2360补充
CAN光端机解决泰和安TX3016C消防主机长距离联网问题 实现CAN与光纤之间的双向数据智能转换
Matlab paper illustration drawing template No. 41 - bubble chart (bubblechart)
12个MySQL慢查询的原因分析
Google 安装印象笔记剪藏插件