Home  >  Article  >  Database  >  mysql两表数据全表复制方法

mysql两表数据全表复制方法

WBOY
WBOYOriginal
2016-06-07 17:51:101024browse

这是一篇使用sql语句将一个表中的数据拷贝到另一个表中简单文章,有需要的朋友可以参考一下。

声名:a,b ,都是表--b表存在(两表结构一样)

insert into b * from a若两表只是有部分(字段)相同,则insert into b(col1,col2,col3,col4,...) select col1,col2,col3,col4,... from a where...把表a插入到表b中去。

--b表不存在
select * into b from a

//select (字段1,字段2,...) into b from a

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn