mysql中insert into select和select into的使用和区别介绍

本篇内容介绍了“mysql中insert into select和select into的使用和区别介绍”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

insert into ... select ...:可将表1中的全部数据或者部分数据复制到表2中。 

eg:复制代码 代码如下: insert into t2(id,name,pwd) select id,name,pwd from t1

注:t2必须存在。t1中查询的列名可不与t1列名相同。无 values select...into:查询t1中的数据,插入到t2中。

eg:复制代码 代码如下: select * into t2 from t1

注:t2被创建并填充数据。

“mysql中insert into select和select into的使用和区别介绍”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注网站,小编将为大家输出更多高质量的实用文章!