
MySQL 复制数据到另外一张表(新建空表、已建空表)
发布日期:2021-05-27 02:41:51
浏览次数:3
分类:技术文章
本文共 480 字,大约阅读时间需要 1 分钟。
一:仅复制表结构到新建表
说明:example_new
为新创建表,example_old
为旧表,操作完成后仅把旧表结构复制到新建表
create table example_new like example_old;
二:复制结构与数据到新建表
说明:创建一名为“example_new
”新表,数据源与表结构来自于旧表example_old
create table example_new select * from example_old;
三:复制数据到已建表
说明:example
表已创建完成,选择旧表example_old
的全部数据到example
表
insert into example select * from example_old;
四:复制数据到已建表(两表数据不一样)
说明:example
表已创建完成,选择旧表example_old
的指定字段数据到已创建的表的指定字段
insert into example (field1,field2…) select (field_a,field_b,…) from example_old;
转载地址:https://blog.csdn.net/kicinio/article/details/109865686 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
感谢大佬
[***.8.128.20]2023年11月07日 06时22分31秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
express之application.js
2019-03-25
express之express.js
2019-03-25
express之全局中间件init
2019-03-25
express之全局中间件query
2019-03-25
express之request.js
2019-03-25
express之response.js
2019-03-25
express之view.js
2019-03-25
express之router
2019-03-25
express之route.js
2019-03-25
express之layer.js
2019-03-25
express内部Layer结构
2019-03-25
typeorm之Entity Listeners
2019-03-25
typeorm之subscriber
2019-03-25
typeorm插入之save与insert
2019-03-25
typeorm更新之save与update、updateById
2019-03-25
typeorm删除之remove与delete
2019-03-25
typeorm之BaseConnectionOptions
2019-03-25
JS数组方法
2019-03-25
typeorm之MysqlQueryRunner
2019-03-25
typeorm之MysqlDriver
2019-03-25