Mysql-将一张表中的数据批量导入另一张表中
2024-10-18 01:35:54
由于mysql不支持select into 方法,mysql怎样将一张表的查询结果存到另一张表中?
找了两个方法
第一种:
create table dust select * from student;//用于复制前未创建新表dust的情况下
第二种
insert into dust select * from student;//已经创建了新表dust的情况下
----------------------------------------------------------------------
如果表结构不一样
insert into 表1 (列名1,列名2,列名3) select 列1,列2,列3 from 表2
不同数据库,需要在表前面加数据库前缀,database.表名。
注意:以上测试过OK,sql语句不需要在insert后面加values。
=============================
测试语句为:insert into xx_company_templates (REL_ID,SET_TIME) select COMPANY_ID,CREATE_TIME from xx_company
最新文章
- Thinkphp 3.2.2 验证码check_verify方法,只能验证一次
- .NET core mvc on Docker
- VS-Visual Studio-IIS Express 支持局域网访问
- WIN8 浏览器排版不兼容问题
- codeforces 489C.Given Length and Sum of Digits... 解题报告
- mysql基础知识(4)--修改
- windowSoftInputMode属性详解
- Jersey(1.19.1) - Hello World, Get started with Jersey using the embedded Grizzly server
- Spring系列
- Mybatis 中一对多,多对一的配置
- mysql学习笔记02 表的操作
- 软件配置管理及SVN的使用
- 几个简单排序算法的Python实现
- RestTemplete
- ReactiveX 学习笔记(20)使用 RxJava + RxBinding 进行 GUI 编程
- windows命令行下杀死进程的方法
- 单线程的redis为什么吞吐量可以这么大
- [Transducer] Make Transducer works for Iteratable collection and Object
- python环境搭建-Linux系统下python2.7升级python3.5.2步骤
- BZOJ 2208 连通数(强连通分量)
热门文章
- 【转】Qt 资源图片删除后,错误 needed by `debug/qrc_image.cpp'. Stop. 的终极解决办法
- LeetCode NO477.汉明距离总和
- Some notes of The Peter Principle
- 安装Angulr CLI
- 第一章 Vue介绍
- anaconda应答文件
- css3 扇形动画
- 使用nodejs进行开发,concurrently模块,使我们同时执行多个命令。
- 《剑指offer》算法题第十二天
- Libreoffice/Office:禁止首字母自动大写功能