当前位置:网站首页>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
边栏推荐
猜你喜欢

mysql 8.0.28版本安装配置方法图文教程

Android Studio 实现登录注册-源代码 (连接MySql数据库)

数学建模笔记:TOPSIS方法(优劣解距离法)和熵权法修正

ORA-04044:此处不允许过程、函数、程序包或类型,系统分析与解决

Matlab paper illustration drawing template No. 41 - bubble chart (bubblechart)

Jmeter使用多线程测试web接口

interrupt()、interrupted()和isInterrupted()你真的懂了吗

12 reasons for MySQL slow query

18年程序员生涯,读了200多本编程书,挑出一些精华分享给大家

MYSQL unique constraint
随机推荐
2022河南萌新联赛第(四)场:郑州轻工业大学 C - 最大公因数
物联网通信协议全解析
Navicat new database
MySQL如何创建用户
【Gazebo入门教程】第一讲 Gazebo的安装、UI界面、SDF文件介绍
MP更新操作方式
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
WiFi、蓝牙、zigbee锁与NB、Cat.1锁的区别
CodeTON Round 2 (Div. 1 + Div. 2, Rated, Prizes!)
MES如何做好生产过程监控,本文给出了详细解答
MYSQL 唯一约束
Matlab论文插图绘制模板第41期—气泡图(bubblechart)
MySQL 8.0.28 version installation and configuration method graphic tutorial
apifox介绍及使用(1)。
数学建模笔记:TOPSIS方法(优劣解距离法)和熵权法修正
【HCIE】NO.30 OSPFv3的基本配置
迅为RK3568开发板编译Buildroot-全自动编译
navicat连接MySQL报错:1045 - Access denied for user ‘root‘@‘localhost‘ (using password YES)
认识消防报警联网中CAN光纤转换器的光纤接口和配套光纤线缆
一线大厂软件测试流程(思维导图)详解